Sasi
Sasi

Reputation: 188

What is the size or length of "Number" datatype used in mongoose schema?

Example Schema:

user
{
name: String,
email: String,
phone: Number
}

"What is the size or length of the field phone with datatype NUMBER"

Upvotes: 2

Views: 1450

Answers (1)

JohnnyHK
JohnnyHK

Reputation: 311865

Depending on what you set the property to for an initial value, Number is either a 32-bit integer or a 64-bit float in the MongoDB document.

But storing phone numbers as actual numbers is typically a bad idea. Better to store them as strings to accommodate phone numbers of arbitrary length.

Upvotes: 2

Related Questions