mongos> db.version();
|
3.4.4
|
mongos> db.people.find().itcount();
|
50474
|
mongos> db.people.find().skip(1000).itcount();
|
49474
|
mongos> var stats = db.people.find().explain("executionStats");
|
mongos> print("nReturned: " + stats.executionStats.nReturned);var total=0;stats.executionStats.executionStages.shards.forEach(function(s){print(s.shardName+" nReturned: "+s.executionStages.nReturned); total += s.executionStages.nReturned;}); print("Sum of shards: " + total);
|
nReturned: 50474
|
shard0000 nReturned: 12130
|
shard0001 nReturned: 13125
|
shard0002 nReturned: 25219
|
Sum of shards: 50474
|
mongos> var stats = db.people.find().skip(1000).explain("executionStats");
|
mongos> print("nReturned: " + stats.executionStats.nReturned);var total=0;stats.executionStats.executionStages.shards.forEach(function(s){print(s.shardName+" nReturned: "+s.executionStages.nReturned); total += s.executionStages.nReturned;}); print("Sum of shards: " + total);
|
nReturned: 47474
|
shard0000 nReturned: 11130
|
shard0001 nReturned: 12125
|
shard0002 nReturned: 24219
|
Sum of shards: 47474
|