Items
.find({author: 'Roberto', isPublished: true})
.sort({name: 1}) // sort ascending. Use -1 for decending
.limit(10) // get first 10 results
.count() // returns total
Items
.select({name: 1, tags: 1}) // return only the listed items (1 is for TRUE)
comparison operators - using $
eq (equal)
ne (not equal)
gt (greater than)
gte (greater than or equal to)
lt (less than)
lte (less than or equal to)
in
nin (not in)
Items
.find({price: {$gt: 10}}) // find all entries greater than 10
.find({price: {$gte: 10}}) // find all entries greater than or equal to 10
.find({price: {$gte: 10, $lte: 20}}) // find all entries inclusive of 10-20
.find({})