Configuration

Configure Nuxt Mongoose with the mongoose property.

nuxt.config
export default defineNuxtConfig({
  mongoose: {
    uri: 'process.env.MONGODB_URI',
    options: {},
    modelsDir: 'models',
    devtools: true,
  },
})
KeyTypeDefaultDescription
uristringprocess.env.MONGODB_URIConnection Uri String
optionsConnectOptions{ }Connection Options
modelsDirstringmodelsThe models(schema) directory located in server for auto-import
devtoolsbooleantrueEnable Mongoose module in Nuxt Devtools