Minimongo findOne time differencess


On the Client

var doc = someCollection.findOne( key ) // Fast
var doc = someCollection.findOne( { _id: key } ) // Slow

Why completion times are different?


There’s a special case for when the selector is just an _id string, in which case the collection works more like a hash map than like an array.

We should probably add this case for the { _id: "x"} form as well, but for now just use the “shorthand” for the faster speed.

See the code here:


Yes you are right, same speed. (_id: ‘X’) == (X)
The slow one is (uniqueField: ‘X’). Appx 4 times slower.


Fixed it: