Translate special fields in precondition filter

This commit is contained in:
Zaid Abdulla committed 2017-03-21 15:28:37 -07:00
1 parent 48f861a6a5
commit 9db29bb55d
1 file changed
+11
+11
View File
@@ -289,6 +289,17 @@ convertMongoQueryToFilters = (query, filters) ->
v = v.replace(/[^a-zA-Z0-9\-]+/g, '_') v = v.replace(/[^a-zA-Z0-9\-]+/g, '_')
filters["Tags.#{v}"] = true filters["Tags.#{v}"] = true
else else
switch k
when '_id' then k = 'DeviceID.ID'
when '_deviceId._Manufacturer' then k = 'DeviceID.Manufacturer'
when '_deviceId._OUI' then k = 'DeviceID.OUI'
when '_deviceId._ProductClass' then k = 'DeviceID.ProductClass'
when '_deviceId._SerialNumber' then k = 'DeviceID.SerialNumber'
when '_lastInform' then k = 'Events.Inform'
when '_lastBootstrap' then k = 'Events.0_BOOTSTRAP'
when '_lastBoot' then k = 'Events.1_BOOT'
when '_registered' then k = 'Events.Registered'
if common.typeOf(v) is common.OBJECT_TYPE if common.typeOf(v) is common.OBJECT_TYPE
for kk, vv of v for kk, vv of v
switch kk switch kk