Skip to content

Commit 77a8520

Browse files
committed
refactor: mongo deprecation warnings on database connect and returnOriginal
1 parent 9a6bb6b commit 77a8520

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.md

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ ___
174174
- refactor: deprecate `Parse.Cloud.httpRequest`; it is recommended to use a HTTP library instead. (Daniel Blyth) [#7595](https://github.com/parse-community/parse-server/pull/7595)
175175
- refactor: Modernize HTTPRequest tests (brandongregoryscott) [#7604](https://github.com/parse-community/parse-server/pull/7604)
176176
- Allow liveQuery on Session class (Daniel Blyth) [#7554](https://github.com/parse-community/parse-server/pull/7554)
177+
- Fix Mongo deprecation warnings on database connect and returnOriginal (Moumouls) [#7626](https://github.com/parse-community/parse-server/pull/7626)
177178

178179
# 4.10.4
179180
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.10.3...4.10.4)

src/Adapters/Storage/Mongo/MongoStorageAdapter.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ export class MongoStorageAdapter implements StorageAdapter {
180180
delete this.connectionPromise;
181181
return;
182182
}
183-
database.on('error', () => {
183+
client.on('error', () => {
184184
delete this.connectionPromise;
185185
});
186-
database.on('close', () => {
186+
client.on('close', () => {
187187
delete this.connectionPromise;
188188
});
189189
this.client = client;
@@ -555,7 +555,7 @@ export class MongoStorageAdapter implements StorageAdapter {
555555
return this._adaptiveCollection(className)
556556
.then(collection =>
557557
collection._mongoCollection.findOneAndUpdate(mongoWhere, mongoUpdate, {
558-
returnOriginal: false,
558+
returnDocument: 'after',
559559
session: transactionalSession || undefined,
560560
})
561561
)

0 commit comments

Comments
 (0)