Refactoring day1

This commit is contained in:
2020-08-20 20:27:14 +02:00
parent 6aceefeb2f
commit b907489a75
481 changed files with 5321 additions and 5616 deletions

View File

@@ -169,6 +169,7 @@ 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() {
@@ -325,8 +326,8 @@ class ChangeStreamCursor extends Cursor {
_initializeCursor(callback) {
super._initializeCursor((err, result) => {
if (err || result == null) {
callback(err, result);
if (err) {
callback(err);
return;
}
@@ -482,11 +483,6 @@ 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;