db.movieDetails.find(
{ year: 2013, imdb.rating: Pg-13, award.wins: 0 },
{ title: 1, _id: 0 }
).pretty();
The mongo shell returns this error
2016-08-13T09:08:00.648+0200 E QUERY [thread1] SyntaxError: missing : after property id @(shell):1:60
Why? Thank you in advance!
This error also comes if ":" is missed.
In my case I missed the ":" after $set like the below.
db.myData.updateOne({_id:ObjectId("new_id")},{$set{name:"new_name"}})
I faced the same error mentioned in the title and my changed code that works is
db.myData.updateOne({_id:ObjectId("new_id")},{$set:{name:"new_name"}})
Hope this helps people who did my mistake.
If your query includes inner documents, then use quotes for them. Also, use quotes for querying String values
db.movieDetails.find(
{ year: 2013, "imdb.rating": "Pg-13", "award.wins": 0 },
{ title: 1, _id: 0 }
).pretty();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With