Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jue-henry committed Dec 5, 2024
1 parent 52e93e1 commit 39150d8
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/api/db/models/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
);

Expand Down

0 comments on commit 39150d8

Please # to comment.