mongo-cursor-pagination
mongo-cursor-pagination copied to clipboard
Document aggregation
It looks like the aggregate method isn't documented in readme.md. Not sure if this was intentional or not.
how to use the aggregate method ? May i know if you are already using aggregation using mongoose
@chaitu14341 Yes I am using aggregate extensively. The docs are in the source code here https://github.com/mixmaxhq/mongo-cursor-pagination/blob/master/src/aggregate.js#L5
how to use the aggregate method ? May i know if you are already using aggregation using mongoose
No, with mongoose plugin there is only find method. I'm trying to add aggregate() into mongoose plugin but still not working as expected.
Update: Actually it works, I've just confused because the aggregate() method of this plugin add the $sort based on _id right after the aggregated results, which make my $geoNear results completely shuffled. Otherwise it works.
@sangdth, I am not seeing aggregate.js
being required or used in the mongoose.plugin.js. How were you able to use aggregate rather than find()
or search()
?
Hi @nathanielrindlaub, unfortunately I forgot the context, it's 2020 my friend. But a quick look into the source code, I think you can't use aggregate() if you want to use it as Mongoose's plugin. Mongo and Mongoose are different things.
They export separated things in the index.js file, so I believe the last time I had to give up on using this code.