create + use adapter count instead of collection count
This commit is contained in:
@@ -205,6 +205,12 @@ export class MongoStorageAdapter {
|
||||
.then(objects => objects.map(object => transform.mongoObjectToParseObject(className, object, schema)));
|
||||
}
|
||||
|
||||
// Executs a count.
|
||||
count(className, query, mongoOptions) {
|
||||
return this.adaptiveCollection(className)
|
||||
.then(collection => collection.count(query, mongoOptions));
|
||||
}
|
||||
|
||||
get transform() {
|
||||
return transform;
|
||||
}
|
||||
|
||||
@@ -699,7 +699,7 @@ DatabaseController.prototype.find = function(className, query, {
|
||||
if (count) {
|
||||
let mongoWhere = this.transform.transformWhere(className, query, schema);
|
||||
delete mongoOptions.limit;
|
||||
return collection.count(mongoWhere, mongoOptions);
|
||||
return this.adapter.count(className, mongoWhere, mongoOptions);
|
||||
} else {
|
||||
return this.adapter.find(className, query, mongoOptions, schema)
|
||||
.then(objects => objects.map(object => filterSensitiveData(isMaster, aclGroup, className, object)));
|
||||
|
||||
Reference in New Issue
Block a user