We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to use MongoDB's positional operator in a generated updateOne/updateMany resolver?
updateOne
updateMany
For example, I would like to make an update like this (from Mongo's doc):
db.students.updateOne( { _id: 1, grades: 80 }, # Finding the 80 value in the grades array { $set: { "grades.$" : 82 } } # Replacing it by an 82 )
On my server, I've set the following generated update mutation:
// ... schemaComposer.Mutation.addFields({ studentUpdateOne: StudentTC.mongooseResolvers.updateOne(), }); // ...
On my client, I've tried the following query and some others but I can't get the $ to not generate syntax errors:
$
mutation { studentUpdateOne( filter: { # Filtering works OK _id: 1, grades: 80 }, record: { # Updating throws syntax errors grades: { $: 82 } # I also tried ` "grades.$": 82 ` and ` grades["$"]: 82 ` with no luck } ) { record { _id grades } } }
I am not yet very familiar with GraphQL syntax so I may be missing an easy fix. But is it at all possible? Thanks
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is it possible to use MongoDB's positional operator in a generated
updateOne
/updateMany
resolver?For example, I would like to make an update like this (from Mongo's doc):
On my server, I've set the following generated update mutation:
On my client, I've tried the following query and some others but I can't get the
$
to not generate syntax errors:I am not yet very familiar with GraphQL syntax so I may be missing an easy fix.
But is it at all possible?
Thanks
The text was updated successfully, but these errors were encountered: