I am doing testing on my large collection, there is a special need to
get single random record from my collection which is having a millions
of record in it ?
Thanks
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
On Dec 24, 10:30 am, Kristina Chodorow <krist...@10gen.com> wrote:
> There's no built-in way. You could do a count, generate a random number
> between 0 and the count, then do
> db.bigCollection.find().limit(-1).skip(randomNum).next().
>
> On Wed, Dec 23, 2009 at 11:58 PM, jignesh patel <jignesh.dadhan...@gmail.com
>
> > wrote:
> > Hi,
>
> > I am doing testing on my large collection, there is a special need to
> > get single random record from my collection which is having a millions
> > of record in it ?
>
> > Thanks
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "mongodb-user" group.
> > To post to this group, send email to mongod...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > mongodb-user...@googlegroups.com<mongodb-user%2Bunsu...@googlegroups.com>