Explain query plan
Show execution stats including index usage
db.orders.find({status:'new'}).explain('executionStats')
- tool
- mongodb20 commands
More mongodb commands
-
db.orders.createIndex({userId: 1, createdAt: -1}, {background: true})Ascending userId + descending createdAt index
-
db.orders.aggregate([{$match:{status:'paid'}},{$group:{_id:'$userId',total:{$sum:'$amount'}}},{$sort:{total:-1}},{$limit:10}])Top 10 users by paid order amount
-
rs.printSecondaryReplicationInfo()Show secondary lag and oplog window
-
db.currentOp({active:true, secs_running:{$gt:5}})List operations running longer than 5 seconds
-
mongodump --uri='mongodb://localhost:27017' --db=mydb --out=/backup/$(date +%F)Dump all collections in a database to BSON files