I am looking to get a random record from a huge (100 million record) mongodb.
mongodb
What is the fastest and most efficient way to do so? The data is already t
I'd suggest adding a random int field to each object. Then you can just do a
findOne({random_field: {$gte: rand()}})
to pick a random document. Just make sure you ensureIndex({random_field:1})