Skip to content

Instantly share code, notes, and snippets.

@WillieYang
Last active June 21, 2017 14:57
Show Gist options
  • Select an option

  • Save WillieYang/6d74a339bae2b714a6d68060d5fbc0e7 to your computer and use it in GitHub Desktop.

Select an option

Save WillieYang/6d74a339bae2b714a6d68060d5fbc0e7 to your computer and use it in GitHub Desktop.
Why cannot get the review when filter it by id() method.
// The reason is that the id()method only match the field whose name is _id.
// The id of subdocument can be specified using ObjectID(), but it need to be specified into a form of _id.
"reviews" : [
{
"author" : "Jack Lee",
"_id" : ObjectId("5937bd3e8f3da38b9429bba2"),
"rating" : 5,
"timestamp" : ISODate("2017-05-15T23:00:00Z"),
"reviewText" : "Quite, and the coffee is yummy!!!"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment