Changes
This commit is contained in:
10
node_modules/mongodb/lib/change_stream.js
generated
vendored
10
node_modules/mongodb/lib/change_stream.js
generated
vendored
@@ -169,7 +169,6 @@ class ChangeStream extends EventEmitter {
|
||||
/**
|
||||
* Is the change stream closed
|
||||
* @method ChangeStream.prototype.isClosed
|
||||
* @param {boolean} [checkCursor=true] also check if the underlying cursor is closed
|
||||
* @return {boolean}
|
||||
*/
|
||||
isClosed() {
|
||||
@@ -326,8 +325,8 @@ class ChangeStreamCursor extends Cursor {
|
||||
|
||||
_initializeCursor(callback) {
|
||||
super._initializeCursor((err, result) => {
|
||||
if (err) {
|
||||
callback(err);
|
||||
if (err || result == null) {
|
||||
callback(err, result);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -483,6 +482,11 @@ function waitForTopologyConnected(topology, options, callback) {
|
||||
function processNewChange(changeStream, change, callback) {
|
||||
const cursor = changeStream.cursor;
|
||||
|
||||
// a null change means the cursor has been notified, implicitly closing the change stream
|
||||
if (change == null) {
|
||||
changeStream.closed = true;
|
||||
}
|
||||
|
||||
if (changeStream.closed) {
|
||||
if (callback) callback(new MongoError('ChangeStream is closed'));
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user