Fix bug saving falsy attributes
This commit is contained in:
1 parent
e909d783e2
commit
85aadf6cb1
1 file changed
+1
-1
@@ -654,7 +654,7 @@ function saveDevice(deviceId, deviceData, isNew, sessionTimestamp, callback) {
|
|||||||
for (const attrName of Object.keys(diff[1])) {
|
for (const attrName of Object.keys(diff[1])) {
|
||||||
if (
|
if (
|
||||||
diff[1][attrName][1] != null &&
|
diff[1][attrName][1] != null &&
|
||||||
(!diff[2] || !diff[2][attrName] || !diff[2][attrName][1])
|
(!diff[2] || !diff[2][attrName] || diff[2][attrName][1] == null)
|
||||||
) {
|
) {
|
||||||
update["$unset"][path.concat(`_${attrName}`).join(".")] = 1;
|
update["$unset"][path.concat(`_${attrName}`).join(".")] = 1;
|
||||||
if (attrName === "value") {
|
if (attrName === "value") {
|
||||||
|
|||||||
Reference in new issue
Block a user