Last active
June 21, 2017 14:57
-
-
Save WillieYang/6d74a339bae2b714a6d68060d5fbc0e7 to your computer and use it in GitHub Desktop.
Why cannot get the review when filter it by id() method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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