Query too large mongodb c# -


i`m trying make query in robomongo there seems many results in query.

list<dataobject> list = collection.findas<dataobject>(query.eq("item1", "value1")).tolist(); foreach (dataobject item in list) {     //do } 

from read, need use mongocursor, couldnt find example, there iterate through using batches of 1000?

something like:

mongocursor<dataobject> cursor = collection.findas<dataobject>(query.eq("item1", "value1")); int batchnumber = 1000; list<dataobject> list; while(list = cursor.getbatch(batchnumber);) {     foreach (dataobject item in list)     {         //do     } } 

now understood solve if dont save in list before foreach doing :

foreach (dataobject item in collection.findas<dataobject>(query.eq("item1", "value1"))) {      //do } 

this solved not saving result in list before foreach. this

foreach (dataobject item in collection.findas<dataobject>(query.eq("item1", "value1"))) {      //do } 

Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -