-
Notifications
You must be signed in to change notification settings - Fork 71.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update mongo libs from 3.6 to 5 #8314
base: dev
Are you sure you want to change the base?
Changes from 1 commit
f2d32c8
d46c5b4
e7d7fd5
5a36647
e60e093
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -302,6 +302,7 @@ function init (env, ctx, server) { | |
// field_2: another_value | ||
// } | ||
// } | ||
// TODO: tests, data models | ||
socket.on('dbAdd', function dbAdd (data, callback) { | ||
console.log(LOG_WS + 'dbAdd client ID: ', socket.client.id, ' data: ', data); | ||
var collection = supportedCollections[data.collection]; | ||
|
@@ -405,20 +406,22 @@ function init (env, ctx, server) { | |
} | ||
// if not found create new record | ||
console.log(LOG_DEDUP + 'Adding new record'); | ||
ctx.store.collection(collection).insert(data.data, function insertResult (err, doc) { | ||
ctx.store.collection(collection).insertOne(data.data, function insertResult (err, ops) { | ||
if (err != null && err.message) { | ||
console.log('treatments data insertion error: ', err.message); | ||
return; | ||
} | ||
|
||
var doc = data.data; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have a roadmap or anything around browser support? How much longer will the codebase use Looks like any android/ios device since 2011 should support let/const - there are no vendor-currently-supported os/browser combinations that don't support them. Maybe the approach could be "use nightscout 15 for old browsers" and do any work on the f/e to support newer testing/frameworks in a nightscout v16 that will only support newer browsers? I think you'll rapidly paint yourself into a corner if "we're not waiting" becomes "we support your ancient devices forever" |
||
doc._id = ops.insertedId; | ||
ctx.bus.emit('data-update', { | ||
type: data.collection | ||
, op: 'update' | ||
, changes: ctx.ddata.processRawDataForRuntime(doc.ops) | ||
, changes: ctx.ddata.processRawDataForRuntime([doc]) | ||
}); | ||
|
||
if (callback) { | ||
callback(doc.ops); | ||
callback([doc]); | ||
} | ||
ctx.bus.emit('data-received'); | ||
}); | ||
|
@@ -453,38 +456,42 @@ function init (env, ctx, server) { | |
|
||
}); | ||
|
||
ctx.store.collection(collection).insert(data.data, function insertResult (err, doc) { | ||
ctx.store.collection(collection).insertOne(data.data, function insertResult (err, ops) { | ||
if (err != null && err.message) { | ||
console.log('devicestatus insertion error: ', err.message); | ||
return; | ||
} | ||
|
||
var doc = data.data; | ||
doc._id = ops.insertedId; | ||
ctx.bus.emit('data-update', { | ||
type: 'devicestatus' | ||
, op: 'update' | ||
, changes: ctx.ddata.processRawDataForRuntime(doc.ops) | ||
, changes: ctx.ddata.processRawDataForRuntime([doc]) | ||
}); | ||
|
||
if (callback) { | ||
callback(doc.ops); | ||
callback([doc]); | ||
} | ||
ctx.bus.emit('data-received'); | ||
}); | ||
} else { | ||
ctx.store.collection(collection).insert(data.data, function insertResult (err, doc) { | ||
ctx.store.collection(collection).insertOne(data.data, function insertResult (err, ops) { | ||
if (err != null && err.message) { | ||
console.log(data.collection + ' insertion error: ', err.message); | ||
return; | ||
} | ||
|
||
var doc = data.data; | ||
doc._id = ops.insertedId; | ||
ctx.bus.emit('data-update', { | ||
type: data.collection | ||
, op: 'update' | ||
, changes: ctx.ddata.processRawDataForRuntime(doc.ops) | ||
, changes: ctx.ddata.processRawDataForRuntime([doc]) | ||
}); | ||
|
||
if (callback) { | ||
callback(doc.ops); | ||
callback([doc]); | ||
} | ||
ctx.bus.emit('data-received'); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AAPS folks: do multiple documents come through this interface as an array? Can you provide any examples?