feat: upgrade to MongoDB Node.js driver 4.x for MongoDB 5.0 support (#7794)
BREAKING CHANGE: The MongoDB GridStore adapter has been removed. By default, Parse Server already uses GridFS, so if you do not manually use the GridStore adapter, you can ignore this change.
This commit is contained in:
@@ -479,6 +479,7 @@ export class MongoStorageAdapter implements StorageAdapter {
|
||||
const mongoObject = parseObjectToMongoObjectForCreate(className, object, schema);
|
||||
return this._adaptiveCollection(className)
|
||||
.then(collection => collection.insertOne(mongoObject, transactionalSession))
|
||||
.then(() => ({ ops: [mongoObject] }))
|
||||
.catch(error => {
|
||||
if (error.code === 11000) {
|
||||
// Duplicate value
|
||||
@@ -517,8 +518,8 @@ export class MongoStorageAdapter implements StorageAdapter {
|
||||
})
|
||||
.catch(err => this.handleError(err))
|
||||
.then(
|
||||
({ result }) => {
|
||||
if (result.n === 0) {
|
||||
({ deletedCount }) => {
|
||||
if (deletedCount === 0) {
|
||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Object not found.');
|
||||
}
|
||||
return Promise.resolve();
|
||||
|
||||
Reference in New Issue
Block a user