support db migrations

This commit is contained in:
Aleksandr Trushkin
2024-08-13 13:15:11 +03:00
parent 880f67aa73
commit 30e5968e03
11 changed files with 163 additions and 9 deletions

View File

@ -95,7 +95,9 @@ func (r statsRepository) Upsert(ctx context.Context, stats entities.DeviceStatis
UpdatedAt: time.Now(),
}
_, err := r.collection.UpdateOne(ctx, filter, document, opts)
update := bson.M{"$set": document}
_, err := r.collection.UpdateOne(ctx, filter, update, opts)
if err != nil {
return fmt.Errorf("inserting: %w", err)
}