You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the bug has not already been reported
Mongoose version
6.5
Node.js version
16.15
MongoDB server version
mongo:5 from official Docker repo
Description
I have a unit test that was working fine in v6.4.7. In 6.5.0 change stream throws an exception when mongoose.disconnect() is called at the of the test.
Home/git/openbeta/openbeta-graphql/node_modules/mongodb/lib/utils.js:419
throw error;
^
TypeError: Cannot read properties of undefined (reading 'fullDocument')
at ChangeStream.<anonymous> (/Home/git/openbeta/openbeta-graphql/node_modules/mongoose/lib/cursor/ChangeStream.js:57:22)
at ChangeStream.emit (node:events:539:35)
at ChangeStreamCursor.<anonymous> (/Home/git/openbeta/openbeta-graphql/node_modules/mongodb/src/change_stream.ts:817:46)
at ChangeStreamCursor.emit (node:events:527:28)
at /Home/git/openbeta/openbeta-graphql/node_modules/mongodb/src/cursor/abstract_cursor.ts:823:18
at /Home/git/openbeta/openbeta-graphql/node_modules/mongodb/src/utils.ts:535:5
at completeEndSession (/Home/git/openbeta/openbeta-graphql/node_modules/mongodb/src/sessions.ts:283:9)
at /Home/git/openbeta/openbeta-graphql/node_modules/mongodb/src/sessions.ts:297:7
at maybePromise (/Home/git/openbeta/openbeta-graphql/node_modules/mongodb/src/utils.ts:520:3)
at ClientSession.endSession (/Home/git/openbeta/openbeta-graphql/node_modules/mongodb/src/sessions.ts:258:24)
e
Steps to Reproduce
Important: Test requires a replica set.
awaitmongoose.connect(`mongodb://${user}:${pass}@${server}/testdb?authSource=admin&readPreference=primary&ssl=false&replicaSet=${rsName}`,{autoIndex: false})constchangeStream=mongoose.connection.watch(pipeline,{fullDocument: 'updateLookup'})conststream=changeStream.on('change',change=>{console.log(change)})awaitstream.close()// not helpingawaitmongoose.disconnect()
Expected Behavior
No undefined exception like in v6.4.7
The text was updated successfully, but these errors were encountered:
vnugent
changed the title
in v6.5.0 mongoose.disconnect() causing Cannot read properties of undefined (reading 'fullDocument')
In v6.5.0 mongoose.disconnect() causing Cannot read properties of undefined (reading 'fullDocument')
Jul 29, 2022
Prerequisites
Mongoose version
6.5
Node.js version
16.15
MongoDB server version
mongo:5 from official Docker repo
Description
I have a unit test that was working fine in v6.4.7. In 6.5.0 change stream throws an exception when
mongoose.disconnect()
is called at the of the test.data
is undefined herehttps://github.com/Automattic/mongoose/blob/6.5/lib/cursor/ChangeStream.js#L57
Steps to Reproduce
Important: Test requires a replica set.
Expected Behavior
No undefined exception like in v6.4.7
The text was updated successfully, but these errors were encountered: