From 39150d8bd49fab7a53801a4342f0d060766fdb61 Mon Sep 17 00:00:00 2001 From: jue-henry Date: Wed, 4 Dec 2024 17:00:46 -0800 Subject: [PATCH] fix comment --- src/api/db/models/Project.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/api/db/models/Project.ts b/src/api/db/models/Project.ts index 71a596a4..080427fe 100644 --- a/src/api/db/models/Project.ts +++ b/src/api/db/models/Project.ts @@ -250,18 +250,13 @@ export class ProjectModel { console.log('originalProject: ', project); console.log('Deleteing camera config with _id: ', input.cameraId); - // NOTE: using findOneAndUpdate() with an aggregation pipeline to update - // Projects to preserve atomicity of the operation and avoid race conditions - // during bulk upload image ingestion. - // https://github.com/tnc-ca-geo/animl-api/issues/112 + // NOTE: using findOneAndUpdate() to update Projects to preserve atomicity of the + // operation and avoid race conditions const updatedProject = await Project.findOneAndUpdate( { _id: context.user['curr_project'] }, - [ - { $addFields: { camIds: '$cameraConfigs._id' } }, - { - $pull: { cameraConfigs: { _id: input.cameraId } }, - }, - ], + { + $pull: { cameraConfigs: { _id: input.cameraId } }, + }, { returnDocument: 'after' }, );