This may be a very simple problem, but this is my first time using GraphQL and FaunaDB. I’m trying to set up a simple database with links to sound files stored in an aws s3 bucket with some basic information stored along with them. I have an index all_stems
that just points to the stems collection.
My schema:
type Stem {
name: String!
url: String!
contributer: String
description: String
id: ID!
}
type Query {
allStems: [Stem!]! @resolver (name: "get_all_stems")
}
type Mutation {
addStem(
name: String!
url: String!
contributer: String
description: String
) : Stem @resolver (name: "add_stem")
}
and my two resolver functions are as follows
add_stem:
Query(
Lambda(
["name", "url", "contributer", "description"],
Create(Collection("stems"), {
data: {
name: Var("name"),
url: Var("url"),
description: Var("description"),
contributer: Var("contributer"),
id: NewId()
}
})
)
)
get_all_stems:
Query(
Lambda(
"_",
Map(Paginate(Match(Index("all_stems"))), Lambda("X", Get(Var("X"))))
)
)
My addStem
mutation works fine, but my problem is that when I try to run the allStems
query in the GraphQL playground on the FaunaDB dashboard, like so:
query {
allStems {
name
}
}
I get this error:
"Can't convert '{data: [{name: \"ambient1\"}, {name: \"crash\"}, {name: \"drum loop 1\"}]}' to Vector"
Being new to FaunaDB, I’m really not sure where I’ve gone wrong, as the information I need is present, but there seems to be some kind of type error.