<https://www.prisma.io/docs/reference/service-conf...
# orm-help
e
https://www.prisma.io/docs/reference/service-configuration/data-model/data-modelling-(sdl)-eiroozae8u/#required-relations
Note that a to-many relation field is always set to required. For example, a field that contains many user addresses always uses the type [Address!]! and can never be of type [Address!]. The reason is that in case the field doesn't contain any nodes, [] will be returned, which is not null.
a
I'd also love some clarification on this. I understand why
[Address]!
is important. I don't understand the benefits of
[Address!]!
though.
a
[Address]!
means you have a guarantee of an array, but that array could have null values in it
[null]
would be a legal response in that schema.
🙌 1
a
Ah. That makes perfect sense. Thanks for taking the time to respond 🙂
e
@Avi Block so
[Address!]!
does not mean that there's always at least one item in the array (of type
Address
? It just means that if there is an item, it must be an
Address
?
a
The outer ! means that value can't be null...so you're guaranteed that there will be an array. The inner ! guarantees that in the array will only be Addresses, and not also nulls
e
makes total sense 🙂 thanks!