修复 MongoDB 更新操作中 $set 字段为空时的 panic 问题
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user