Skip to content

Commit

Permalink
fix save device with last measure with mongodb 8
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvaroVega committed Jan 8, 2025
1 parent 60bad44 commit 564b40a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/services/devices/deviceRegistryMongoDB.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,19 @@ function storeLastMeasure(measure, typeInformation, callback) {
/* eslint-disable-next-line new-cap */
const deviceObj = new Device.model(data);
deviceObj.isNew = false;
deviceObj.save(saveDeviceHandler(callback));
deviceObj
.save({})
.then((deviceDao) => {
callback(null, deviceDao.toObject());
})
.catch((error) => {
logger.debug(
fillService(context, deviceObj),
'Error storing device information: %s',
error
);
callback(new errors.InternalDbError(error));
});
}
}
);
Expand Down

0 comments on commit 564b40a

Please sign in to comment.