Setting cursor error when using aggregate in Node.js

the previous parameter setting of cursor was incorrect, but now it has been modified:

clipboard.png

:
Error: Arguments must be aggregate pipeline operators

clipboard.png

want to know why there is an error in the first way. I think many examples are written in the middle of the earth

.
Mar.05,2021

there must be error messages. No, you console.log (JSON.stringify (err)) .
on the surface, it should be [{cursor: {batchSize: 10000}] this should be an object, not an array, without brackets.


the second parameter options is an object. Take a look at what the document says

.

should be written like this

  

guess that you are writing in mongoose,. The second way is correct.
the first is OK if it is db.collection.aggregate ().

Menu