2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-19 03:25:44 +00:00
cheat.sheets/sheets/_mongo/logical

13 lines
293 B
Plaintext
Raw Normal View History

2018-01-06 17:19:18 +00:00
// 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}}]} )