Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
Fixed TylerBrock#182: "The 'cursor' option is required"
Browse files Browse the repository at this point in the history
This fixes the Mongodb 3.6+ error message "failedToParse: The 'cursor' option is required, except for aggregate with the explain argument" for aggregates
  • Loading branch information
wolph committed Oct 27, 2018
1 parent f15ce3f commit 5fdf310
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hacks/aggregation.js
Expand Up @@ -18,6 +18,10 @@ DBCollection.prototype.aggregate = function( ops, extraOpts ){
extraOpts = {};
}

if (extraOpts.cursor === undefined){
extraOpts.cursor = {batchSize: 1000};
}

var cmd = {pipeline: arr};
Object.extend(cmd, extraOpts);

Expand Down

1 comment on commit 5fdf310

@gopeshjangid2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how can we use aggregate in php without cursor for mongodb 4. actually i am getting the error

"he 'cursor' option is required"

Please sign in to comment.