diff --git a/src/Adapters/Storage/Mongo/MongoStorageAdapter.js b/src/Adapters/Storage/Mongo/MongoStorageAdapter.js index 39cbcb5db8..e134f0c06f 100644 --- a/src/Adapters/Storage/Mongo/MongoStorageAdapter.js +++ b/src/Adapters/Storage/Mongo/MongoStorageAdapter.js @@ -180,10 +180,10 @@ export class MongoStorageAdapter implements StorageAdapter { delete this.connectionPromise; return; } - database.on('error', () => { + client.on('error', () => { delete this.connectionPromise; }); - database.on('close', () => { + client.on('close', () => { delete this.connectionPromise; }); this.client = client; @@ -555,7 +555,7 @@ export class MongoStorageAdapter implements StorageAdapter { return this._adaptiveCollection(className) .then(collection => collection._mongoCollection.findOneAndUpdate(mongoWhere, mongoUpdate, { - returnOriginal: false, + returnDocument: 'after', session: transactionalSession || undefined, }) )