Skip to content

Commit

Permalink
chore: follow up migration for location refacotring
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Burtey committed Feb 2, 2024
1 parent f548dc8 commit 110d5cd
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions core/api/src/migrations/20240201124500-location-migration-2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint @typescript-eslint/ban-ts-comment: "off" */
// @ts-nocheck

async function migrateAccounts(db, batchSize = 100) {
db.collection("accounts")
.updateMany(
{},
{
$unset: { title: "", coordinates: "" },
},
)
.then((result) => {
console.log(`Processed ${result.modifiedCount} accounts`)
})
.catch((err) => {
console.error("Error updating documents: ", err)
})
}

module.exports = {
async up(db) {
console.log("Begin migration removal of title/location")
await migrateAccounts(db)
console.log("Migration completed removal of title/location")
},
}

0 comments on commit 110d5cd

Please sign in to comment.