Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document aggregation #54

Open
antony opened this issue Dec 10, 2018 · 5 comments
Open

Document aggregation #54

antony opened this issue Dec 10, 2018 · 5 comments

Comments

@antony
Copy link

antony commented Dec 10, 2018

It looks like the aggregate method isn't documented in readme.md. Not sure if this was intentional or not.

@chaitu14341
Copy link

chaitu14341 commented Dec 20, 2018

how to use the aggregate method ? May i know if you are already using aggregation using mongoose

@antony
Copy link
Author

antony commented Dec 20, 2018

@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

@sangdth
Copy link

sangdth commented Jan 3, 2020

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.

@nathanielrindlaub
Copy link

nathanielrindlaub commented May 19, 2022

@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()?

@sangdth
Copy link

sangdth commented May 21, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants