diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-02-16 21:40:58 +0100 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-02-16 21:40:58 +0100 |
commit | 20660444fd9a20c192301b62f4ef284c8f507b55 (patch) | |
tree | 6dbb2a32f21234874e1f09377dd1295cc6591576 /src/util | |
parent | :bug: fix database (diff) | |
download | server-20660444fd9a20c192301b62f4ef284c8f507b55.tar.xz |
:bug: fix Mongodb BigInt
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/MongoBigInt.ts | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util/MongoBigInt.ts b/src/util/MongoBigInt.ts index cc185bed..e16d087a 100644 --- a/src/util/MongoBigInt.ts +++ b/src/util/MongoBigInt.ts @@ -33,7 +33,7 @@ class LongSchema extends mongoose.SchemaType { cast(val: any, scope?: any, init?: any) { if (null === val) return val; if ("" === val) return null; - + if (typeof val === "bigint") return mongoose.mongo.Long.fromString(val.toString()); if (val instanceof mongoose.mongo.Long) return BigInt(val.toString()); if (val instanceof Number || "number" == typeof val) return BigInt(val); if (!Array.isArray(val) && val.toString) return BigInt(val.toString()); |