mongodb-cross-cursor
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -42,10 +42,20 @@ "use strict"; | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
const cmd = yield this.client.db(this.namespace).command({ | ||
getMore: (0, utils_1.stringToLong)(this.sharedCursor.cursorId), | ||
collection: "articles", | ||
batchSize: this.batchSize | ||
}, { | ||
session: (0, utils_1.fakeSessionBuilder)(this.sharedCursor.sessionId) | ||
return Promise.resolve() | ||
.then(() => { | ||
return this.client.db(this.namespace).command({ | ||
getMore: (0, utils_1.stringToLong)(this.sharedCursor.cursorId), | ||
collection: "articles", | ||
batchSize: this.batchSize | ||
}, { | ||
session: (0, utils_1.fakeSessionBuilder)(this.sharedCursor.sessionId) | ||
}); | ||
}).then((result) => { | ||
return result.cursor.nextBatch || []; | ||
}).catch((error) => { | ||
var _a; | ||
if (((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.indexOf("cursor id")) !== -1) { | ||
return Promise.resolve([]); | ||
} | ||
return Promise.reject(error); | ||
}); | ||
return cmd.cursor.nextBatch; | ||
}); | ||
@@ -52,0 +62,0 @@ } |
{ | ||
"name": "mongodb-cross-cursor", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"author": "Baptiste Jamin <baptiste@crisp.chat> (https://crisp.chat)", | ||
@@ -5,0 +5,0 @@ "description": "A mongodb driver extension allowing to consume MongoDB cursors accross multiple instances", |
Sorry, the diff of this file is not supported yet
10719
181