0

I am using express with mongoose in mongodB's local type (mongodB compass). I was defining float type of datatype while creating a schema in mongoose, but it is showing me an error [here is the error] (https://i.stack.imgur.com/WFAGM.png) what if we have to define float type value like 10000000.25 also what another datatype we can use in place of float?

Note-I tried both float and Float but none is working.

1 Answers1

0

You can use Number type to store floating values in MongoDB

equity: { type: Number },

OR

You can use the Decimal128 type.

equity: { type:mongoose.Types.Decimal128 }

More Clarification about Decimal128 visit this link https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.Decimal128