|
|
|
|
@ -63,7 +63,15 @@ func (u *UserMgo) UpdateByMap(ctx context.Context, userID string, args map[strin
|
|
|
|
|
if len(args) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
return mongoutil.UpdateOne(ctx, u.coll, bson.M{"user_id": userID}, bson.M{"$set": args}, true)
|
|
|
|
|
filter := bson.M{"user_id": userID}
|
|
|
|
|
update := bson.M{"$set": args}
|
|
|
|
|
if err := mongoutil.UpdateOne(ctx, u.coll, filter, update, true); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Keep user attributes in sync for consumers that read from the "attribute" collection.
|
|
|
|
|
attributeColl := u.coll.Database().Collection("attribute")
|
|
|
|
|
return mongoutil.UpdateOne(ctx, attributeColl, filter, update, true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (u *UserMgo) Find(ctx context.Context, userIDs []string) (users []*model.User, err error) {
|
|
|
|
|
|