SSPkrolik / nimongo

Pure Nim lang MongoDB driver
http://sspkrolik.github.io/nimongo
MIT License
101 stars 20 forks source link

Iterator only returns 101 documents of results #77

Closed JosephBoyd closed 4 years ago

JosephBoyd commented 4 years ago

When synchronously calling find on a collection I receive the correct total from count(), but when iterating using items() I am only ever able to get 101 documents

Create new Mongo client

var m = newMongo(server)

Connect to Mongo server

let connectResult = m.connect()

Specify collection

let collection = m[database][collection] let cnow = getTime() - initDuration(days = 1) echo cnow let fetched = collection.find(%*{"upsertedAt": {"$lt": cnow}}, @[field]) let tally = fetched.count()

I get correct total of 1,821,187 documents

echo "Total: ", tally

BUT I only get 101 using the following

for c in fetched.items(): echo c["_id"]

JosephBoyd commented 4 years ago

Specifying "limit" before iteration gets around this