mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix
This commit is contained in:
1 file changed
+5
-2
@@ -342,11 +342,14 @@ class UserModel {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e?.code === 11000) {
|
if (e?.code === 11000) {
|
||||||
// Duplicate Key Error
|
// Duplicate Key Error
|
||||||
|
if (autoAlloc && JSON.stringify(e.keyPattern) === '{"_id":1}') {
|
||||||
|
uid++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
throw new UserAlreadyExistError(Object.values(e?.keyValue || {}));
|
throw new UserAlreadyExistError(Object.values(e?.keyValue || {}));
|
||||||
}
|
}
|
||||||
if (!autoAlloc || JSON.stringify(e.keyPattern) !== '{"_id":1}') throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
uid++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user