I have updated mongo and now in the log the following error appears:
Use of the aggregate command without the cursor option is deprecated
Mongo says that I should put a second REQUIRED parameter to aggregate function, because my current usage is deprecated.
I currently use the following code PHP (now is deprecated):
$this->db->{$collection}->aggregate($options);And return this format:
{"result":[
{
"_id":"xxxxxx",
"update":[
{
"firstUpdateTime":xxxxxx,
"updateTime":xxxxxxx,
}
],
"media":[
{
"xxxx":{ ...To not use an deprecated code I add the new second parameter (but I do not understand what to put):
$this->db->{$collection}->aggregate($options, array('cursor' => array('batchSize' => 1)));And this returns the same information but varies the initial structure:
{"cursor":{
"id":{
"value":"xxxxxx"
},
"ns":"xxxxxx.instagram",
"firstBatch":[
{
"_id":"xxxxxx",
"update":[
{
"firstUpdateTime":xxxxxx,
"updateTime":xxxxxx,
}
],
"media":[
{
"xxxxxx":{ ...After the update Mongo forces me to change the way I read the data. I don't understand what value I should put in that second parameter called "cursor"...
What should I put in that second parameter? Can I set a default value without altering the structure of results?
Doc:
https://docs.mongodb.com/manual/reference/method/db.collection.aggregate/
What should I put in that second parameter? Can I set a default value without altering the structure of results?