From 49157ada183b5ef174031e15149eb88718594aab Mon Sep 17 00:00:00 2001 From: Jamie Date: Fri, 15 Dec 2023 09:10:31 +1300 Subject: [PATCH] counts --- .../20231128_jellyfish_migration.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/migrations/20231128_jellyfish_migration/20231128_jellyfish_migration.go b/migrations/20231128_jellyfish_migration/20231128_jellyfish_migration.go index ab1e9d88a..0506d1bc4 100644 --- a/migrations/20231128_jellyfish_migration/20231128_jellyfish_migration.go +++ b/migrations/20231128_jellyfish_migration/20231128_jellyfish_migration.go @@ -340,7 +340,6 @@ func (m *Migration) blockUntilDBReady() error { func (m *Migration) fetchAndUpdateBatch() bool { selector := bson.M{ - // jellyfish uses a generated _id that is not an mongo objectId "_deduplicator": bson.M{"$exists": false}, // testing based on _userId for jamie+qa3_1@tidepool.org "_userId": "5e8cac61-6bef-4728-b490-c1d82087ed9c", @@ -352,6 +351,7 @@ func (m *Migration) fetchAndUpdateBatch() bool { bson.M{"_id": bson.M{"$not": bson.M{"$type": "objectId"}}}, } } else { + // jellyfish uses a generated _id that is not an mongo objectId selector["_id"] = bson.M{"$not": bson.M{"$type": "objectId"}} } log.Printf("selector: %#v", selector) @@ -438,7 +438,8 @@ func (m *Migration) writeBatchUpdates() (int, error) { log.Printf("error writing batch updates %v", err) return updateCount, err } - updateCount = updateCount + int(results.ModifiedCount) + log.Printf("update results %v", results) + updateCount += int(results.ModifiedCount) } } log.Printf("applied %d updates", updateCount)