Closed claude-abounegm closed 3 years ago
@claude-abounegm Much thanks.
@claude-abounegm Can you add a test case too.
@aravindnc will do soon!
FYI there's a breaking change that's not mentioned which means you cannot use $geoNear
queries when useFacet
is set to true
with the error message $geoNear is not allowed to be used within a $facet stage
so if you're using this in your aggregatepaginate query using the mongoose-aggregate-paginate-v2
package, you'll need to set this to false
. Further reading: https://www.mongodb.com/docs/manual/reference/operator/aggregation/facet/
This pull request contains two features:
$facet
operator is now being used by default instead of executing two queries. To disable, passuseFacet: false
to the options.Aggregate
is extended and paginate can now be called directly usingaggregate.paginateExec(options, [cb])
.If
countQuery
anduseFacet
, two queries will still be executed, and facet will be ignored.Breaking Changes:
$facet
is now used by default.