From 500123ea65d0e1eb24c7cf64ab00a16af09a1528 Mon Sep 17 00:00:00 2001 From: nicolasburtey Date: Fri, 2 Feb 2024 18:18:32 +0000 Subject: [PATCH] fix: migration for location (#3935) value can exist but be null Co-authored-by: Nicolas Burtey --- .../api/src/migrations/20240130210000-location-migration-1.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/api/src/migrations/20240130210000-location-migration-1.ts b/core/api/src/migrations/20240130210000-location-migration-1.ts index 22b95f78df..035e6e714e 100644 --- a/core/api/src/migrations/20240130210000-location-migration-1.ts +++ b/core/api/src/migrations/20240130210000-location-migration-1.ts @@ -5,7 +5,9 @@ const nodeCrypto = require("crypto") async function migrateAccounts(db, batchSize = 100) { - const cursor = db.collection("accounts").find({ title: { $exists: true } }) + const cursor = db.collection("accounts").find({ + $and: [{ title: { $ne: null } }, { coordinates: { $ne: null } }], + }) let batchCount = 0 while (await cursor.hasNext()) {