You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the Nightscout-API to delete the types devicestatus and treatsments we noticed that the function remove(_id, fn) doesn't work properly. The delete seems to have no effect.
I'm not sure why it doesn't work as it was written. I don't believe the PR should cause a different result, but it works and preserves the benefits of using ObjectID and the '*' option for devicestatus.
Using the Nightscout-API to delete the types devicestatus and treatsments we noticed that the function remove(_id, fn) doesn't work properly. The delete seems to have no effect.
Treatments:
https://github.com/nightscout/cgm-remote-monitor/blob/master/lib/server/treatments.js
Line: 100
The original code looks like this:
function remove (_id, fn) { api( ).remove({ '_id': new ObjectID(_id) }, fn); ctx.bus.emit('data-received'); }
Our solution:
function remove (_id, fn) { api( ).remove({ '_id': _id }, fn); ctx.bus.emit('data-received'); }
Devicestatus:
https://github.com/nightscout/cgm-remote-monitor/blob/master/lib/server/devicestatus.js
Line: 62
The original code looks like this:
function remove (_id, fn) { var filter; if (_id === '*') { filter = {}; } else { filter = { '_id': new ObjectID(_id) }; } return api( ).remove(filter, fn); }
Our solution:
function remove (_id, fn) { return api( ).remove('_id': _id , fn); }
Using this fix, the delete function works.
The text was updated successfully, but these errors were encountered: