menu

EdgeDB

Bringing state-of-the-art database technology to the masses.

Channels
Team

GraphQL insert error: TypeError: argument of type 'NoneType' is not iterable

February 19, 2020 at 2:42pm

GraphQL insert error: TypeError: argument of type 'NoneType' is not iterable

February 19, 2020 at 2:42pm
I'm getting an error trying to inserts some nested data, with a link being set deep in the nesting:
mutation insert_teams {
insert_Team( data: [
{
name: "Test Team",
members: [
{filter: {email: {eq: "1@example.com"}}}, <--- OK
{filter: {email: {eq: "2@example.com"}}}
],
chats: [
{
data: {
topic: "Ressources & info",
messages: [
{
data: {
sender: {filter: {email: {eq: "1@example.com"}}}, <-- Error
content: "Blah blah blah"
}
}
]
}
}
]
}
] )
{ id }
}
Schema looks like
type Person {
property first_name -> str;
property last_name -> str;
property email -> str;
}
type Team extending Page {
property name -> str;
multi link members -> Person;
multi link chats -> Chat;
}
type Chat {
property topic -> str;
multi link messages -> TextMessage
}
type TextMessage {
link sender -> Person;
required property content -> str;
}
Is there a way to do this or is it not supported?

February 19, 2020 at 3:32pm
This looks like a bug, nested inserts like this should work. ?
  • reply
  • like

February 19, 2020 at 10:46pm
This is indeed a bug and will be fixed soon (I'm almost done with the fix). However, I wanted to point out that the schema as written is invalid as it refers to Page which isn't defined (I guess this is probably because you've copy/pasted only a portion of the entire schema). More importantly, if you want the filter on email field to work as written, i.e. to select a single Person, you need to change the Person to be like:
type Person {
property first_name -> str;
property last_name -> str;
property email -> str {
# This constraint ensures that if you filter by an exact match on the email,
# you're guaranteed to get at most one result and don't need to use a LIMIT 1
# to assign that result to a [single] link.
constraint exclusive;
}
}
  • reply
  • like