-
-
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
Aggregate cursor is undefined #3160
Comments
One of the unfortunate quirks of the .aggregate() implementation right now is that it doesn't work with buffering, so you need to do
to wait for mongoose to connect to the db before using the aggregation cursor :( This is something that will be improved in the future, but unfortunately something you need to work around for now. |
This does not work. var cursor = MyModel
.aggregate([
{
$match: {
mark : "some mark"
}
}
])
.cursor({ batchSize: 1000 })
.exec(function() {
// never cause
});
cursor
.on('error', function(err) {
})
.on('data', function(data) {
})
.on('end', function() {
}); it is work too. |
Yeah another way to get it to work is in the |
Confirmed TimonKK's issue with on('connected') not working. This does not work with mongoose 4.0.8 and mongo 3.0.3
cursor will be undefined. However, if you use the mongoose.connect callback it does work:
|
When adding the
I am using:
|
@raoulwegat can you open up a separate issue with a code sample please? |
Yes of course, here you go: #4101. |
Thanks, much appreciated |
I think the label "pending release" is incorrect because this was already released to my understanding? |
@mhombach yep that's incorrect, I'll fix that. |
I am trying this code:
from Mongoose API
But i have
I am using
The text was updated successfully, but these errors were encountered: