Select
These examples will work with data from Inserting documents.
Prettify output to make it at least readable
.pretty()
Select all
> db.collection.find().pretty()
select and filter
Equals
> db.bands.find({active: true}).pretty()
Comparison: greater than (>), less than (<) — gte, lte also works
> db.bands.find({year_started: {$gt: 1980}}).pretty()
> db.bands.find({year_started: {$lt: 1980}}).pretty()
And
> db.bands.find({active: true, year_started: {$gte: 1970}}).pretty()
Or
> db.bands.find( {$or: [ {active: true}, {year_started: {$gte: 1970}} ] }).pretty()