Move transform acl (#2021)
* Move ACL transforming into Parse Server For the database adapters, it will be more performant and easier to work with _rperm and _wperm than with the ACL object. This way we can type it as an array and so on, and once we have stronger validations in Parse Server, we can type it as an array containing strings of length < x, which will be much much better in sql databases. * Use destructuring
This commit is contained in:
@@ -212,12 +212,14 @@ export class MongoStorageAdapter {
|
||||
.then(collection => collection.updateMany(mongoWhere, mongoUpdate));
|
||||
}
|
||||
|
||||
// Hopefully we can get rid of this in favor of updateObjectsByQuery.
|
||||
// Atomically finds and updates an object based on query.
|
||||
// Resolve with the updated object.
|
||||
findOneAndUpdate(className, query, schema, update) {
|
||||
const mongoUpdate = transformUpdate(className, update, schema);
|
||||
const mongoWhere = transformWhere(className, query, schema);
|
||||
return this.adaptiveCollection(className)
|
||||
.then(collection => collection.findOneAndUpdate(mongoWhere, mongoUpdate));
|
||||
.then(collection => collection._mongoCollection.findAndModify(mongoWhere, [], mongoUpdate, { new: true }))
|
||||
.then(result => result.value);
|
||||
}
|
||||
|
||||
// Hopefully we can get rid of this. It's only used for config and hooks.
|
||||
|
||||
Reference in New Issue
Block a user