-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Does mongoose support Mongo Aggregate Cursor (mongo 2.6) #2187
Comments
Right now, unfortunately, the MongoDB node driver supports this via an option, but mongoose doesn't :( For now, you can access a raw mongodb driver collection object using |
@mattbryson 3.8.14 will have a |
Hi, having trouble getting this working. (mongoose 3.8.12, mongo 2.6.3) Firstly, how do you set it if you call aggregate on the model with a callback?
The above errors saying its not valid aggregation stage. And when trying via the aggregation object that is returned
The callback is never executed. If I omit the cursor() option, the callback is executed. |
Hmm weird. I'll investigate this |
Did you get any time to look into this? |
Not quite yet. I should be able to knock this out and release 3.8.15 by the end of the week, but time is scarce :( |
:) yeah, tell me about it! If I can help test in anyway let us know. |
I'm also available to test, hitting the same issue here as well. Strangely, if I do the following: I see in the mongod log for the aggregate query that the cursor batchSize is 1, which seems to kill performance. Any idea what I can do in the interim to force a higher batchSize until I can just do model.aggregate.cursor? edit: I am currently on v3.8.14, let me know if I should try another branch, tag, etc for testing. |
Actually, @mattbryson , are you still using mongoose 3.8.12? If you are, the |
Hi, was there any progress on this? We are using 3.8.14 - was this added in a later version? cheers m |
Has there been any progress on this? I'm using version. 3.8.26 and I have the same problem. This is my implementation:
I think it has something to do with the the code in lib/aggregate.js, in the exec function. The exec function calls 'this._model.collection.aggregate' (passing in the promise's resolve function), and then proceeds to return the promise. But the collection.aggregate function doesn't use that promise in anyway IF a cursor is requested. It instead returns an aggregate cursor. The result is you end up with an unresolved promise, and obviously no cursor. lib/model.js
lib/aggregate.js
mongodb driver: lib/collection/aggregation.js
As you can see the AggregationCursor isn't even concerned with the promise anymore, so it never gets resolved. I may be wrong, but this is my best guess. Let me know if my understanding is based on a wrong assumption. |
See #2306, there's rudimentary support for aggregation cursor in 4.0.2. |
Hi,
We are hitting the 16MB doc limit when using the aggregation pipeline, so have upgraded mongo to use 2.6 which supports cursors.
I can run the aggregation on the mongo terminal, and it iterates the cursor, but I cant see how to do this via the mongoose aggregation api.
Any help would be much appreciated..
m
The text was updated successfully, but these errors were encountered: