I have updated mongo and now in the log the following error appears: Use of the aggregate command without the cursor option is deprecated
Mo
When you query something to MongoDB and you expect results, you will have this variable called cursor
, which simply is a pointer to the document you currently did read. It is just like a scrollbar in the browser.
You can specify how many documents it should read into a buffer batchSize
as you did with value 1
.
It is useful when you know how much documents you expect to read. When you only need 10 documents, you can get all those in a single network packet using batchSize => 10
. When specify batchSize => 5
, it will take longer because it does take two network packets to the database to get the expected 10 documents.
You are safe using the default batchSize
.
You can try to iterate over the cursor using foreach
like in an example in the docs: http://php.net/manual/en/class.mongocommandcursor.php
Im not sure if the php.net documentation is up to date with the most current version of the MongoDB driver.