xxxxxxxxxx
//Show all records
db.users.find()
//Show specific records
db.users.find({firstName:"Hazrat"})
//use of $and
//Show specific records that match 2 fields.
db.users.find({
$and:[
{firstName:"Hazrat"},
{lastName:"Umar"}
]
})
//use of $or
//Show specific records that optionally match 2 fields.
db.users.find({
$or:[
{firstName:"Hazrat"},
{lastName:"Umar"}
]
})
xxxxxxxxxx
db.inventory.find( { $and: [ { price: { $ne: 1.99 } }, { price: { $exists: true } } ] } )