pull/236/head
wangchuxiao 3 years ago
parent 3b81108738
commit edb5cb4ee5

@ -981,7 +981,11 @@ func (d *DataBases) CreateSuperGroup(groupID string, initMemberIDList []string,
UserID: v,
})
}
_, err = c.UpdateOne(sCtx, users, bson.M{"$addToSet": bson.M{"group_id_list": groupID}})
upsert := true
opts := &options.UpdateOptions{
Upsert: &upsert,
}
_, err = c.UpdateMany(sCtx, bson.M{"user_id": bson.M{"$in": initMemberIDList}}, bson.M{"$addToSet": bson.M{"group_id_list": groupID}}, opts)
if err != nil {
session.AbortTransaction(ctx)
return utils.Wrap(err, "transaction failed")

Loading…
Cancel
Save