diff --git a/mongo/mongo.go b/mongo/mongo.go index c86cb62..c262864 100644 --- a/mongo/mongo.go +++ b/mongo/mongo.go @@ -498,7 +498,10 @@ func (m *MongoDB) Update(ctx context.Context, filter bson.M, update bson.M, coll } } } - setDoc := update["$set"].(bson.M) + setDoc := bson.M{} + if !g.IsEmpty(update["$set"]) { + setDoc = update["$set"].(bson.M) + } if !g.IsEmpty(user.UserName) { setDoc["updater"] = user.UserName }