implement observeChangesAsync on the client

This commit is contained in:
Nacho Codoñer
2024-02-22 15:59:54 +01:00
parent 13483b8e9d
commit 14efff200b
2 changed files with 8 additions and 2 deletions

View File

@@ -373,6 +373,13 @@ export default class Cursor {
return handle;
}
observeChangesAsync(options) {
return new Promise((resolve) => {
const handle = this.observeChanges(options);
handle.isReadyPromise.then(() => resolve(handle));
});
}
// XXX Maybe we need a version of observe that just calls a callback if
// anything changed.
_depend(changers, _allow_unordered) {

View File

@@ -966,8 +966,7 @@ Cursor.prototype.observeChanges = function (callbacks, options = {}) {
};
Cursor.prototype.observeChangesAsync = async function (callbacks, options = {}) {
var self = this;
return self.observeChanges(callbacks, options);
return this.observeChanges(callbacks, options);
};
MongoConnection.prototype._createSynchronousCursor = function(