transformWhere in MongoAdapter
This commit is contained in:
@@ -199,8 +199,9 @@ export class MongoStorageAdapter {
|
|||||||
|
|
||||||
// Executes a find. Accepts: className, query in Parse format, and { skip, limit, sort }.
|
// Executes a find. Accepts: className, query in Parse format, and { skip, limit, sort }.
|
||||||
find(className, query, { skip, limit, sort }, schema) {
|
find(className, query, { skip, limit, sort }, schema) {
|
||||||
|
let mongoWhere = this.transform.transformWhere(className, query, schema);
|
||||||
return this.adaptiveCollection(className)
|
return this.adaptiveCollection(className)
|
||||||
.then(collection => collection.find(query, { skip, limit, sort }))
|
.then(collection => collection.find(mongoWhere, { skip, limit, sort }))
|
||||||
.then(objects => objects.map(object => transform.mongoObjectToParseObject(className, object, schema)));
|
.then(objects => objects.map(object => transform.mongoObjectToParseObject(className, object, schema)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -696,12 +696,12 @@ DatabaseController.prototype.find = function(className, query, {
|
|||||||
query = addReadACL(query, aclGroup);
|
query = addReadACL(query, aclGroup);
|
||||||
}
|
}
|
||||||
validateQuery(query);
|
validateQuery(query);
|
||||||
let mongoWhere = this.transform.transformWhere(className, query, schema);
|
|
||||||
if (count) {
|
if (count) {
|
||||||
|
let mongoWhere = this.transform.transformWhere(className, query, schema);
|
||||||
delete mongoOptions.limit;
|
delete mongoOptions.limit;
|
||||||
return collection.count(mongoWhere, mongoOptions);
|
return collection.count(mongoWhere, mongoOptions);
|
||||||
} else {
|
} else {
|
||||||
return this.adapter.find(className, mongoWhere, mongoOptions, schema)
|
return this.adapter.find(className, query, mongoOptions, schema)
|
||||||
.then(objects => objects.map(object => filterSensitiveData(isMaster, aclGroup, className, object)));
|
.then(objects => objects.map(object => filterSensitiveData(isMaster, aclGroup, className, object)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user