-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update to be able to test a single user
- Loading branch information
Showing
1 changed file
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ type Migration struct { | |
updates []mongo.WriteModel | ||
dryRun bool | ||
stopOnErr bool | ||
migrateItemID string | ||
lastUpdatedId string | ||
} | ||
|
||
|
@@ -162,6 +163,12 @@ func (m *Migration) Initialize() error { | |
//uri string comes from file called `uri` | ||
FilePath: "./uri", | ||
}, | ||
cli.StringFlag{ | ||
Name: "test-id", | ||
Usage: "id of single user to migrate", | ||
Destination: &m.migrateItemID, | ||
Required: false, | ||
}, | ||
) | ||
return nil | ||
} | ||
|
@@ -364,8 +371,16 @@ func (m *Migration) blockUntilDBReady() error { | |
func (m *Migration) fetchAndUpdateBatch() bool { | ||
selector := bson.M{ | ||
"_deduplicator": bson.M{"$exists": false}, | ||
// testing based on _userId for [email protected] | ||
"_userId": "6d1ca155-68e6-4cd6-9ed2-1b8e743d5f4a", | ||
} | ||
|
||
if m.migrateItemID != "" { | ||
selector["_userId"] = m.migrateItemID | ||
log.Printf("setting id of single user %v ", selector) | ||
} | ||
|
||
if selector["_userId"] == nil { | ||
log.Printf("testing so we need a user id %v", selector) | ||
return false | ||
} | ||
|
||
// jellyfish uses a generated _id that is not an mongo objectId | ||
|