Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(i=0;i<1000;i++){db.doc.insert({"doc":{"k1":"v_"+i,"k2":i},"scal":i})}
- var d1 = db.doc.findOne()
- {
- "_id" : ObjectId("5ce25f8920b0be2428648e38"),
- "doc" : {
- "k1" : "v_0",
- "k2" : 0
- },
- "scal" : 0
- }
- db.doc.createIndex({"doc":1})
- db.doc.createIndex({"scal":1})
- db.doc.explain(true).find({doc:{$gt:d1.doc}},{_id:0,doc:1})
- {
- ...
- "executionStats" : {
- "executionSuccess" : true,
- "nReturned" : 999,
- "executionTimeMillis" : 1,
- "totalKeysExamined" : 999,
- "totalDocsExamined" : 999,
- ...
- }
- db.doc.explain(true).find({scal:{$gt:d1.scal}},{_id:0,scal:1})
- {
- ...
- "executionStats" : {
- "executionSuccess" : true,
- "nReturned" : 999,
- "executionTimeMillis" : 0,
- "totalKeysExamined" : 999,
- "totalDocsExamined" : 0,
- ...
- }
- db.doc.explain(true).find({doc:d1.doc},{_id:0,doc:1})
- {
- ...
- "executionStats" : {
- "executionSuccess" : true,
- "nReturned" : 1,
- "executionTimeMillis" : 0,
- "totalKeysExamined" : 1,
- "totalDocsExamined" : 0,
- ...
- }
- var dis = db.doc.distinct("doc")
- db.doc.explain(true).find({doc:{$in:dis}},{_id:0,doc:1})
- {
- ...
- "executionStats" : {
- "executionSuccess" : true,
- "nReturned" : 1000,
- "executionTimeMillis" : 8,
- "totalKeysExamined" : 1000,
- "totalDocsExamined" : 0,
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement