I'm quite new to mongodb and I'm having some issues I cannot find answers to.
My question is performance I suppose. When I'm trying to query a collection using db.collection.find()
I can get all the result and look through them in robomongo. What I need is getting all the objects into array. I perform db.collection.find().toArray()
which doesn't return anything. That said db.collection.find().limit(1000).toArray()
returns an array with 1000 elements just fine. So I made a conclusion that this is somehow related to performance. The collection I query has about 9000 elements, which is not that much.
Here are several lines from stats()
output:
"count" : 9139,
"size" : 9210256,
"avgObjSize" : 1007,
"numExtents" : 6,
"storageSize" : 11182080,
"lastExtentSize" : 8388608.0,
"paddingFactor" : 1.0,
Using forEach()
on cursor doesn't seem to make things better. So I wonder how would one get objects of a collection into array?