I am trying to find time required to perform a count() on a collection which is consisting of millions of testdata records, with following scenario:-
1) From 1st Mongo shell I am inserting millions of records into collection using a code
for (var i = 0; i < 10000000; ++i){
db.unicorns.insert({name: 'sampleName', gender: 'm', weight: '440' });
}
2) From 2ndMongo shell I am trying to find count() on that collection(Imp: while insertion is still getting executed on 1st Mongo Shell)
db.unicorns.count()
I researched but found that explain() and stats() cannot be applied to count() command.
some
I need to find out how much time it takes to count() when there are insertions going on collection(something like a live scenario)?
Is there any other good approach for doing this?