Skip to content

Commit

Permalink
fix: LBA-2348 ajout $merge pour persister les données (#1353)
Browse files Browse the repository at this point in the history
* fix: ajout $merge pour persister les données

* feat: déjà traité migration précédente
  • Loading branch information
alanlr authored Jul 11, 2024
1 parent 0366ec8 commit 7df079f
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Db } from "mongodb"

import { logger } from "@/common/logger"

export const up = async (db: Db) => {
logger.info("202407110000000-migrate-fix-emailblacklists_2 started")

await db.collection("emailblacklists").aggregate([
{
$replaceWith: {
$unsetField: {
field: { $literal: "$setOnInsert" },
input: "$$ROOT",
},
},
},
{
$merge: {
into: "emailblacklists",
on: "_id",
whenMatched: "replace",
},
},
])

logger.info("202407110000000-migrate-fix-emailblacklists_2 ended")
}

0 comments on commit 7df079f

Please sign in to comment.