Skip to content

Commit

Permalink
Ajusta Condição para Mundanças de tenant
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelgfirmino committed Jan 17, 2025
1 parent f3979f1 commit da30efd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Import.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type Config struct {
SourceClient MongoConfig `yaml:"source"`
DestinyClient MongoConfig `yaml:"destiny"`
Tenants []string `yaml:"tenants"`
TenantDesity string `yaml:"tenantDestiny"`
TenantDestiny string `yaml:"tenantDestiny"`
Timeout int `yaml:"timeout"`
}
type Collection struct {
Expand Down Expand Up @@ -165,14 +165,14 @@ func dbDestiny(ctx context.Context, db Config, collection Collection) {

var documents []interface{}
var copiedCount int64
tenantDestiny, _ := uuidToBinary(db.TenantDesity)
tenantDestiny, _ := uuidToBinary(db.TenantDestiny)
if collection.Upsert == "true" || collection.Upsert == "" {
for cursor.Next(ctx) {
var document bson.M
if err := cursor.Decode(&document); err != nil {
log.Fatal(err)
}
if document["TenantId"] == nil && !tenantDestiny.IsZero() {
if !tenantDestiny.IsZero() {
document["TenantId"] = tenantDestiny
}
_, err := destinyCollection.UpdateOne(
Expand Down

0 comments on commit da30efd

Please sign in to comment.