TonyGen / mongodb-erlang

Fork of MongoDB driver for Erlang. mongodb now holds the master repository for this driver.
65 stars 16 forks source link

problem with batchsize #12

Open raviraj555 opened 12 years ago

raviraj555 commented 12 years ago

Hi TonyGen in mongodb table I have 50k data in this 50k I have 20k data with some username(ravi1) Cur = mongo:find (emaillist, {'$query', {'userName', UserName}, '$orderby', {'userName',1}}, {},0, 5),

when I do such find query, here I get 5 records but it takes same time finding all 20k records but if

Cur = mongo:find (emaillist, {'$query', {'userName', UserName}, '$orderby', {'userName',1}}, {},19,995, 5)

this also gives me 5 records but in no time

why first query takes more time to find 5 records is there any other way so that I can get record faster in any case