0

I can't figure this one out. Trying to add a field in all documents where a field matches the expression.

Am trying various combinations of the below updateMany query:

db.fixtures.updateMany({"competition": "League Division 1"}, $set{"comp_id":"5c65d916456b5d0e207778ac"})

Keep getting this error:

SyntaxError: missing ) after argument list @(shell):1:65

Can someone please put me out of my misery and tell me what I'm doing wrong so I can enjoy the rest of my Sunday!

Thanks

1 Answer 1

1

You got the syntax wrong...

db.fixtures.updateMany({"competition": "League Division 1"}, {"set":{"comp_id":"5c65d916456b5d0e207778ac"}})
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you! I followed the syntax given in the docs here: docs.mongodb.com/manual/reference/method/…
You don’t have to include the quotation marks but your set operator must be enclosed in an object (curly braces and colon)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.