Skip to content

Conversation

@MilosKozak
Copy link
Contributor

No description provided.

@bewest
Copy link
Member

bewest commented Oct 19, 2023

Looks ok. For contrast, here's how Sulka updated similar areas, it reads a little differently but I think winds up being functionally equivalent.

https://github.com/nightscout/cgm-remote-monitor/blob/master/lib/server/devicestatus.js#L26-L58

@bewest
Copy link
Member

bewest commented Oct 19, 2023

Looks like we might have a check list of sorts:

bewest@equitous:~/src/cgm-remote-monitor$ git grep "insert("
lib/api3/generic/create/operation.js:    await insert(opCtx, doc);
lib/api3/generic/update/operation.js:    await insert(opCtx, doc);
lib/server/activity.js:    api().insert(obj, function (err, doc) {
lib/server/food.js:    api().insert(obj, function (err, doc) {
lib/server/profile.js:    api().insert(obj, function (err, doc) {
lib/server/websocket.js:              ctx.store.collection(collection).insert(data.data, function insertResult (err, doc) {
lib/server/websocket.js:          ctx.store.collection(collection).insert(data.data, function insertResult (err, doc) {
lib/server/websocket.js:          ctx.store.collection(collection).insert(data.data, function insertResult (err, doc) {
testing/populate.js:  cgm_collection.insert(new_cgm_record, function (err) {
bewest@equitous:~/src/cgm-remote-monitor$ git grep "insert("^C
bewest@equitous:~/src/cgm-remote-monitor$ git grep "insertOne("
lib/api3/generic/create/insert.js:  const identifier = await col.storage.insertOne(doc);
lib/api3/storage/mongoCachedCollection/index.js:    const result = await baseStorage.insertOne(doc, { normalize: false });
lib/api3/storage/mongoCollection/index.js:  self.insertOne = (...args) => modify.insertOne(self.col, ...args);
lib/api3/storage/mongoCollection/modify.js:    col.insertOne(doc, function mongoDone(err, result) {
lib/authorization/storage.js:      collection.insertOne(obj, function (err, doc) {
lib/authorization/storage.js:      collection.insertOne(obj, function (err) {
lib/server/devicestatus.js:      api().insertOne(obj, function(err, results) {

@bewest
Copy link
Member

bewest commented Oct 19, 2023

Should we roll back #8026 or continue to make changes?

@MilosKozak
Copy link
Contributor Author

@bewest it's up to you. this patch is working and ready. But we must resolve all other places ....
and not only insert but update and remove as well

@MilosKozak
Copy link
Contributor Author

if rollback makes no conflicts maybe I'd prefer it as a fast solution
and create branch with this commit + patch as a new version

@MilosKozak
Copy link
Contributor Author

calling ctx.bus.emit('data-update' .... on collection level is better anyway

@bewest
Copy link
Member

bewest commented Oct 20, 2023

#8115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants