Support for MongoDB 2.6. Preset precondition is now stored as a JSON string.

This commit is contained in:
Zaid Abdulla committed 2014-05-17 09:35:05 +03:00
1 parent 5bd7c99eea
commit 70ffd8b653
3 files changed
+30 -24

No files matched your search

+5 -1
View File
@@ -28,7 +28,11 @@ exports.getDevicePreset = (deviceId, presets, objects, aliases, callback) ->
# only fetch relevant params
projection = {_id : 1}
for p in presets
p.precondition = query.expand(p.precondition, aliases)
if common.typeOf(p.precondition) is common.STRING_TYPE
p.precondition = query.expand(JSON.parse(p.precondition), aliases)
else
# Accept an object for backward compatiblity
p.precondition = query.expand(p.precondition ? {}, aliases)
mongoQuery.projection(p.precondition, projection)
for c in p.configurations