From 6afe793c527fcaac1d25bad08ab48193d2c81d40 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Fri, 5 Sep 2014 16:01:47 +0300 Subject: [PATCH] Fixed bug where refreshObject does not remove from database parameters that don't exist anymore in the device data model. --- lib/update-device.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/update-device.coffee b/lib/update-device.coffee index 4b2a6ce..713abbd 100644 --- a/lib/update-device.coffee +++ b/lib/update-device.coffee @@ -187,7 +187,7 @@ commitUpdates = (deviceId, deviceUpdates, commitQueue, callback) -> if presentPaths[p] recursive(v, "#{p}.") else - update['$unset'][p] = 1 + update['$unset'][p] = 2 # Scan the DB object and remove parameters that no longer exists in device for path of projection @@ -202,7 +202,7 @@ commitUpdates = (deviceId, deviceUpdates, commitQueue, callback) -> recursive(root, rootPath) else if not presentPaths[rootPath.slice(0, -1)]? - update['$unset'][rootPath.slice(0, -1)] = 1 + update['$unset'][rootPath.slice(0, -1)] = 2 # Remove unnecessary unset updates for k, v of update['$unset']