Skip to content

Instantly share code, notes, and snippets.

@jdjkelly
Created May 30, 2017 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdjkelly/e387d1577b3419aff815774e825b60a5 to your computer and use it in GitHub Desktop.
Save jdjkelly/e387d1577b3419aff815774e825b60a5 to your computer and use it in GitHub Desktop.
match2.js
db.articles.aggregate(
[{ $match: {
$or: [{
score: { $gt: 90 }
}, {
author: "dave"
}}]
}}]
);
// Returns these documents
{ "_id" : ObjectId("512bc95fe835e68f199c8686"), "author" : "dave", "score" : 80 }
{ "_id" : ObjectId("512bc962e835e68f199c8687"), "author" : "dave", "score" : 85 }
{ "_id" : ObjectId("55f5a1d3d4bede9ac365b25a"), "author" : "li", "score" : 94 }
{ "_id" : ObjectId("55f5a1d3d4bede9ac365b25b"), "author" : "ty", "score" : 95 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment