flâneur — a map of the web's best reading

Mongoose v6.6.7: SchemaTypes

mongoosejs.com · 5,034 words · saved by 1 readers

SchemaTypes handle definition of path defaults, validation, getters, setters, field selection defaults for queries, and other general characteristics for Mongoose document properties. You can think of a Mongoose schema as the configuration object for a Mongoose model. A SchemaType is then a configuration object for an individual property. A SchemaType says what type a given path should have, whether it has any getters/setters, and what values are valid for that path. A SchemaType is different from a type. In other words, mongoose.ObjectId !== mongoose.Types.ObjectId. A SchemaType is just a configuration object for Mongoose. An instance of the mongoose.ObjectId SchemaType doesn't actually create MongoDB ObjectIds, it is just a configuration for a path in a schema. The following are all the valid SchemaTypes in Mongoose. Mongoose plugins can also add custom SchemaTypes like int32. Check out Mongoose's plugins search to find plugins. type is a special property in Mongoose schemas. When Mo

SchemaTypes SchemaTypes handle definition of path defaults , validation , getters , setters , field selection defaults for queries , and other general characteristics for Mongoose document properties. What is a SchemaType? The type Key SchemaType Options Usage Notes Getters Custom Types The schema.path() Function Further Reading What is a SchemaType? You can think of a Mongoose schema as the configuration object for a Mongoose model. A SchemaType is then a configuration object for an individual property. A SchemaType says what type a given path should have, whether it has any getters/setters,

Explore this link on the map →

related reading