Open bstahlhood opened 5 years ago
You can pass schema options under models[].options
.
Example:
{
...,
models: [
{
name: "posts",
alias: "Post",
schema: {
title: {
type: String,
required: true,
},
...
},
// add schema configurable options
options: {
timestamps: true,
...
}
},
...
]
}
@alex-ppg I think it would be usefull to include this information in README.md example. If you are interested, I created a pull request https://github.com/alex-ppg/fastify-mongoose/pull/11
In Mongoose, you can pass options to a schema definition such as
toJSON
,toObject
,timestamps
, andid
. How do you pass these with the schema definition?