Hello all, I’m working on a small application to query my Atlas. The size of the collection is trivial now, but I’m looking at performance techniques for the future. In using .find()
and .aggregate()
the node.js driver says they return cursors, which are iterable objects that I can pull out my docs for processing.
My understanding was that either as an option to those methods, or by calling myCursor.batchSize(X)
I would be able to set the number of docs I can pull out per iteration (as opposed to .toArray()
which I’m using and could become unmanageable
Is that correct?
Right now, looping over my cursor with for...await
or while myCursor.hasNext() myCursor.next()
I only get one document at a time. I thought I could at least process them 2, 8, etc at a time with batchSize.