mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix UserModel.inc
This commit is contained in:
1 parent
b7a398db6f
commit
5c3e2d8571
1 file changed
+1
-2
@@ -272,8 +272,7 @@ class UserModel {
|
||||
if (_id < -999) return null;
|
||||
const udoc = await coll.findOne({ _id });
|
||||
if (!udoc) throw new UserNotFoundError(_id);
|
||||
udoc[field] = udoc[field] + n || n;
|
||||
await coll.updateOne({ _id }, { $set: { [field]: udoc[field] } });
|
||||
await coll.updateOne({ _id }, { $inc: { [field]: n } });
|
||||
deleteUserCache(udoc);
|
||||
return udoc;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user