I have a simple query resolver that finds all Documents created by a User.
e.g.
query {
users {
documents {
name
}
}
}
Under the hood it does smth like this:
const requesterOpportunitiesResolver = (_, source) => context.services.get('mongodb-atlas').db('xxxl').collection('documents').find({ user: source._id }).toArray()
Now the question is how do I support all the filtering options that the generated documents
query supports?
Manually map everything from the input to some mongodb queries??
E.g. I want smth like this:
query {
users {
documents (query: {tags_in: ["tag1", "tag2"]}) {
name
}
}
}
Basically the way I imagine it could work is if there was a function to generate mongodb query based on input
argument.