move transformWhere into mongo adapter

This commit is contained in:
Drew Gross
2016-05-23 20:19:03 -07:00
parent 135b0e0254
commit a763f7c2fc
2 changed files with 3 additions and 4 deletions

View File

@@ -206,9 +206,9 @@ export class MongoStorageAdapter {
} }
// Executs a count. // Executs a count.
count(className, query) { count(className, query, schema) {
return this.adaptiveCollection(className) return this.adaptiveCollection(className)
.then(collection => collection.count(query)); .then(collection => collection.count(transform.transformWhere(className, query, schema)));
} }
get transform() { get transform() {

View File

@@ -696,8 +696,7 @@ DatabaseController.prototype.find = function(className, query, {
} }
validateQuery(query); validateQuery(query);
if (count) { if (count) {
let mongoWhere = this.transform.transformWhere(className, query, schema); return this.adapter.count(className, query, schema);
return this.adapter.count(className, mongoWhere);
} else { } else {
return this.adapter.find(className, query, 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)));