mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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;
|
if (_id < -999) return null;
|
||||||
const udoc = await coll.findOne({ _id });
|
const udoc = await coll.findOne({ _id });
|
||||||
if (!udoc) throw new UserNotFoundError(_id);
|
if (!udoc) throw new UserNotFoundError(_id);
|
||||||
udoc[field] = udoc[field] + n || n;
|
await coll.updateOne({ _id }, { $inc: { [field]: n } });
|
||||||
await coll.updateOne({ _id }, { $set: { [field]: udoc[field] } });
|
|
||||||
deleteUserCache(udoc);
|
deleteUserCache(udoc);
|
||||||
return udoc;
|
return udoc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user