-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Description
Queries such as the one that follows no longer work:
var promise = Widgets.count().exec()Here is a trace for an example of this failure (forgive the Heroku timestamps).
15:37:24 web.1 | TypeError: undefined is not a function
15:37:24 web.1 | at /Users/dylan/Sites/AndiIrwin/node_modules/mongoose/node_modules/mongodb/lib/mongodb/collection.js:587:12
15:37:24 web.1 | at Cursor.nextObject (/Users/dylan/Sites/AndiIrwin/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:677:5)
15:37:24 web.1 | at commandHandler (/Users/dylan/Sites/AndiIrwin/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:658:14)
15:37:24 web.1 | at null.<anonymous> (/Users/dylan/Sites/AndiIrwin/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1645:20)
15:37:24 web.1 | at g (events.js:175:14)
15:37:24 web.1 | at EventEmitter.emit (events.js:106:17)
15:37:24 web.1 | at Server.Base._callHandler (/Users/dylan/Sites/AndiIrwin/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:409:25)
15:37:24 web.1 | at /Users/dylan/Sites/AndiIrwin/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:563:20
15:37:24 web.1 | at MongoReply.parseBody (/Users/dylan/Sites/AndiIrwin/node_modules/mongoose/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:131:5)
15:37:24 web.1 | at null.<anonymous> (/Users/dylan/Sites/AndiIrwin/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:521:22)
15:37:24 web.1 | at EventEmitter.emit (events.js:95:17)
15:37:24 web.1 | at null.<anonymous> (/Users/dylan/Sites/AndiIrwin/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:190:13)
15:37:24 web.1 | at EventEmitter.emit (events.js:98:17)
15:37:24 web.1 | at Socket.<anonymous> (/Users/dylan/Sites/AndiIrwin/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:382:22)
15:37:24 web.1 | at Socket.EventEmitter.emit (events.js:95:17)
15:37:24 web.1 | at Socket.<anonymous> (_stream_readable.js:710:14)
15:37:24 web.1 | at Socket.EventEmitter.emit (events.js:92:17)
15:37:24 web.1 | at emitReadable_ (_stream_readable.js:382:10)
15:37:24 web.1 | at emitReadable (_stream_readable.js:378:5)
15:37:24 web.1 | at readableAddChunk (_stream_readable.js:143:7)
15:37:24 web.1 | at Socket.Readable.push (_stream_readable.js:113:10)
15:37:24 web.1 | at TCP.onread (net.js:511:21)
15:37:24 web.1 | exited with code 8
I'm not entirely sure what causes this bug, but it seems to be a problem with the mechanism by which Mongoose handles passing callbacks to the native driver when one doesn't exist. The code for exec() shows that it seemingly just resolves the promise when an op isn't passed, which also seems odd. I'd like to look into this more, but I'm lacking in time.
If there's anything further anyone would like me to check, please let me know.
In my testing I found this only to be the case on 3.6.12, 3.6.11 works perfectly fine.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels