Hi MongoDB community!
I’m having trouble formatting the payload type for a custom GraphQL resolver.
I’m wanting to implement a search query, and return matching documents to a given search. I’ve got the function all set up, but I cannot figure out how to re-use existing schema types from my MongoDB Atlas schema as the payload type.
I want to send an array of documents as the payload, and this was what I came up with:
{
"type": "object",
"title": "SearchResults",
"properties": {
"artists": {
"type": "array",
"description": "Returns the artist documents from this search",
"items": {
"type": "object",
"$ref": "#/realm/mongodb-atlas/music/artists"
}
}
}
}
I’m getting an error when using $ref, and I’m also not sure if the $ref schema link is right. Basically, the artists schema already exists as defined in Realm rules, and I just want to reuse this as the payload type.
Will I just have to redefine the document schema in this payload, or can I access this already-existing schema type?
Thank you so much! Please let me know if this question is clear or if I could add anything else