Given the following schema:
type Article {
headline: String
author: [Author]
}
type Author {
name: String
contributed: [Article]
}
type Query {
getArticles: [Article]
}
With the the following items, in their respective collections:
{
"ref": Ref(Collection("Article"), "322054626916433992"),
"ts": 1643394285230000,
"data": {
"headline": "Foo",
}
}
{
"ref": Ref(Collection("Author"), "322054459536441415"),
"ts": 1643393916590000,
"data": {
"name": "nk"
}
}
The following mutation:
mutation Update{
updateArticle(id: "322054626916433992" data: {
author: {
connect: "322054459536441415"
}
}) {
headline
author {
name
}
}
}
Returns the error:
{
"data": null,
"errors": [
{
"message": "Expected type 'String', found '{connect: \"322054459536441415\"}'. String value expected (line 4, column 20):\n data: {author: {connect: \"322054459536441415\"}}\n ^",
"locations": [
{
"line": 4,
"column": 20
}
]
}
]
}
Why? Why does connect
not seem to work? What’s going on here?
I would expect that this would add a ref
to the Article.author
field to the author, and a ref
on the Author.contributed
field to the article.