diff --git a/lib/factories/definitions.factory.ts b/lib/factories/definitions.factory.ts index 8d467df5..1e93df15 100644 --- a/lib/factories/definitions.factory.ts +++ b/lib/factories/definitions.factory.ts @@ -4,7 +4,15 @@ import * as mongoose from 'mongoose'; import { PropOptions } from '../decorators'; import { TypeMetadataStorage } from '../storages/type-metadata.storage'; -const BUILT_IN_TYPES: Function[] = [Boolean, Number, String, Map, Date, Buffer]; +const BUILT_IN_TYPES: Function[] = [ + Boolean, + Number, + String, + Map, + Date, + Buffer, + BigInt, +]; export class DefinitionsFactory { static createForClass(target: Type): mongoose.SchemaDefinition { diff --git a/tests/e2e/schema-definitions.factory.spec.ts b/tests/e2e/schema-definitions.factory.spec.ts index 347e6d37..d3348271 100644 --- a/tests/e2e/schema-definitions.factory.spec.ts +++ b/tests/e2e/schema-definitions.factory.spec.ts @@ -79,6 +79,9 @@ class ExampleClass { @Prop() array: Array; + + @Prop() + bigint: bigint; } describe('DefinitionsFactory', () => { @@ -103,6 +106,7 @@ describe('DefinitionsFactory', () => { 'customObject', 'any', 'array', + 'bigint', ]); expect(definition).toEqual({ objectId: { @@ -130,6 +134,7 @@ describe('DefinitionsFactory', () => { }, }, ], + bigint: { type: BigInt }, buffer: { type: mongoose.Schema.Types.Buffer }, decimal: { type: mongoose.Schema.Types.Decimal128 }, child: {