2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-01 21:40:24 +00:00
cheat.sheets/sheets/_mongo/comparison

25 lines
446 B
Plaintext
Raw Normal View History

2018-01-06 17:19:18 +00:00
// equals to
db.books.find({year: {$eq: 2016}})
// less than
db.books.find({year: {$lt: 2010}})
// less than or equal to
db.books.find({year: {$lte: 2008}})
// greater than
db.books.find({year: {$gt: 2014}})
// greater than or equal to
db.books.find({year: {$gte: 2008}})
// not equal to
db.books.find({year: {$ne: 2008}})
// value in
db.books.find({year: {$in: [2008, 2016]}})
// value not in
db.books.find({year: {$nin: [2008, 2016]}})