Fixed issue where no projection is applied when there's no presets thus affecting performane
This commit is contained in:
1 parent
c08fb47f18
commit
28f63e8c96
2 files changed
+2
-1
No files matched your search
@@ -83,6 +83,7 @@ projection = (query, proj) ->
|
||||
# optimize projection by removing overlaps
|
||||
optimizeProjection = (obj) ->
|
||||
keys = Object.keys(obj).sort()
|
||||
return if keys.length <= 1
|
||||
for i in [1 ... keys.length]
|
||||
a = keys[i-1]
|
||||
b = keys[i]
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ matchObject = (object, param) ->
|
||||
exports.assertPresets = (deviceId, presetsHash, callback) ->
|
||||
getPresets((presets, objects) ->
|
||||
# only fetch relevant params
|
||||
projection = {}
|
||||
projection = {_id : 1}
|
||||
for p in presets
|
||||
p.precondition = query.expand(p.precondition)
|
||||
mongoQuery.projection(p.precondition, projection)
|
||||
|
||||
Reference in new issue
Block a user