问题
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!
回答1:
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();
来源:https://stackoverflow.com/questions/38930207/query-in-mongo-shell-gives-syntaxerror-missing-after-property