2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-15 06:12:59 +00:00
cheat.sheets/sheets/_mongo/logical
2018-01-06 17:19:18 +00:00

13 lines
293 B
Plaintext

// OR
db.books.find( { $or: [{year: {$lte: 2008}}, {year: {$eq: 2016}}]} )
// AND
db.books.find( { $and: [{year: {$eq: 2008}}, {category: {$eq: "Fiction"}}]} )
// NOT
db.books.find( {$not: {year: {$eq: 2016} }})
// NOR
db.books.find( { $nor: [{year: {$lte: 2008}}, {year: {$eq: 2016}}]} )