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 ().

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf5dbe-31fbe.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf5dbe-31fbe.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?