# query (post is a collection)
db.post.find()
db.post.find().pretty()

# query based on operations
# equality
db.post.find({"title":"My First Post"}).pretty()

# less than
db.post.find({"hits":{$lt:50}}).pretty()

# less than or equal
db.post.find({"hits":{$lte:50}}).pretty()

# greater than
db.post.find({"hits":{$gt:50}}).pretty()

# greater than or equal
db.post.find({"hits":{$gte:50}}).pretty()

# not equal
db.post.find({"hits":{$ne:50}}).pretty()

# and
db.post.find({'title': 'My First Post', 'hits': {$gt:50}}).pretty()

# or
db.post.find({$or: [{'title': 'My First Post'}, {'hits': {$gt:50}}]}).pretty()

# "and" and "or" together
db.post.find({category: 'general', $or: [{'title': 'My First Post'}, {'hits': {$gt:50}}]}).pretty()

# projection: select only specific fields
db.post.find({},{"title":1,_id:0})

# limit, select the last 10
db.post.find().limit(10)

# skip, select the last 10 and skip the first one
db.post.find().limit(10).skip(1)

# sort, sorted by title in descending order 
db.post.find().sort({'title': -1})