# Decorator NumberDecimal

Decorator mongoose schema
Module
import { NumberDecimal } from "@tsed/mongoose"
Source/packages/mongoose/src/decorators/numberDecimal.ts

# Overview

function NumberDecimal(type?: any): any;
Param Type Description
type any Optional. decimal type constructor

# Description

Tell Mongoose whether to define an Decimal128 property. Will be serialized as number with format as decimal.

# Example

@Model()
export class PriceModel {
  @NumberDecimal()
  price: Decimal128;
}
1
2
3
4
5

Optionally using custom decimal type, such as Big from big.js

@Model()
export class PriceModel {
  @NumberDecimal(Big)
  price: Big;
}
1
2
3
4
5

Other topics