Getting Started
Configuration
Configure Nuxt Mongoose with the mongoose property.
nuxt.config.ts
export default defineNuxtConfig({
mongoose: {
uri: process.env.MONGODB_URI,
options: {},
modelsDir: 'models',
devtools: true,
},
})
Key | Type | Default | Description |
---|---|---|---|
uri | string | process.env.MONGODB_URI | Connection Uri String |
options | ConnectOptions | { } | Connection Options |
modelsDir | string | models | The models(schema) directory located in server for auto-import |
devtools | boolean | true | Enable Mongoose module in Nuxt Devtools |