1 line
5.4 KiB
Plaintext
1 line
5.4 KiB
Plaintext
[{"id":"content:0.index.md","path":"/","dir":"","title":"Home","description":"","keywords":[],"body":" Nuxt Mongoose A Nuxt module for simplifying the use of Mongoose in your project. "},{"id":"content:1.getting-started:1.setup.md","path":"/getting-started/setup","dir":"getting-started","title":"Setup","description":"A Nuxt module for simplifying the use of Mongoose in your project.","keywords":["Installation","Options"],"body":" Setup A Nuxt module for simplifying the use of Mongoose in your project. Installation Install nuxt-mongoose to your dependencies. pnpm add nuxt-mongoose -D npm install nuxt-mongoose -D yarn add nuxt-mongoose -D Add nuxt-mongoose to the modules section of your nuxt.config file. export default defineNuxtConfig ({\n modules: [\n 'nuxt-mongoose' ,\n ] ,\n }) That's it! You can now use Mongoose in your Nuxt app ✨ Options You can configure the module by adding a mongoose section to your nuxt.config file.\nread more about Mongoose options . export default defineNuxtConfig ({\n mongoose: {\n // Options\n } ,\n }) If you want to configure only the uri just add MONGODB_URI in your .env file. MONGODB_URI=YOUR_MONGO_URI .dark .ct-443230{color:#FFA657;}\n.ct-443230{color:#953800;}\n.dark .ct-935781{color:#C9D1D9;}\n.ct-935781{color:#24292F;}\n.dark .ct-667011{color:#A5D6FF;}\n.ct-667011{color:#0A3069;}\n.dark .ct-998471{color:#79C0FF;}\n.ct-998471{color:#0550AE;}\n.dark .ct-942366{color:#FF7B72;}\n.ct-942366{color:#CF222E;}\n.dark .ct-923966{color:#D2A8FF;}\n.ct-923966{color:#8250DF;}\n.dark .ct-128513{color:#8B949E;}\n.ct-128513{color:#6E7781;}"},{"id":"content:1.getting-started:3.configuration.md","path":"/getting-started/configuration","dir":"getting-started","title":"Configuration","description":"Configure Nuxt Mongoose with the mongoose property.","keywords":[],"body":" Configuration Configure Nuxt Mongoose with the mongoose property. export default defineNuxtConfig ({\n mongoose: {\n uri: 'process.env.MONGODB_URI' ,\n options: {},\n modelsDir: 'models' ,\n devtools: true ,\n } ,\n }) 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 .dark .ct-942366{color:#FF7B72;}\n.ct-942366{color:#CF222E;}\n.dark .ct-443230{color:#FFA657;}\n.ct-443230{color:#953800;}\n.dark .ct-923966{color:#D2A8FF;}\n.ct-923966{color:#8250DF;}\n.dark .ct-935781{color:#C9D1D9;}\n.ct-935781{color:#24292F;}\n.dark .ct-667011{color:#A5D6FF;}\n.ct-667011{color:#0A3069;}\n.dark .ct-998471{color:#79C0FF;}\n.ct-998471{color:#0550AE;}"},{"id":"content:2.api:1.utils.md","path":"/api/utils","dir":"api","title":"Utils","description":"Discover all available utils.","keywords":["defineMongooseModel","defineMongooseConnection"],"body":" Utils Discover all available utils. defineMongooseModel This function creates a new Mongoose model with schema. Example usage: export const User = defineMongooseModel ({\n name: 'User' ,\n schema: {\n email: {\n type: 'string' ,\n required: true ,\n unique: true ,\n },\n },\n options: {\n \n },\n hooks ( schema ) {\n \n },\n }) import { defineMongooseModel } from '#nuxt/mongoose'\n \n export const User = defineMongooseModel ( 'User' , {\n email: {\n type: 'string' ,\n required: true ,\n unique: true ,\n },\n }, {\n \n }, ( schema ) => {\n \n }) Key Type Require Description name string true Name of Model schema SchemaDefinition true Schema Definition of Model options SchemaOptions false Schema Options for Model hooks (schema: Schema<T>) => void false Schema Hooks Function to customize Model defineMongooseConnection This function creates a new Mongoose connection. nuxt-mongoose provides a default connection for you, it auto-register a plugin in nitro, so you don't need to use this function unless you want to create a new connection. more info here . Example usage: import { defineMongooseConnection } from '#nuxt/mongoose'\n \n export const connection = defineMongooseConnection ( 'mongodb://127.0.0.1/nuxt-mongoose' ) .dark .ct-942366{color:#FF7B72;}\n.ct-942366{color:#CF222E;}\n.dark .ct-935781{color:#C9D1D9;}\n.ct-935781{color:#24292F;}\n.dark .ct-998471{color:#79C0FF;}\n.ct-998471{color:#0550AE;}\n.dark .ct-923966{color:#D2A8FF;}\n.ct-923966{color:#8250DF;}\n.dark .ct-667011{color:#A5D6FF;}\n.ct-667011{color:#0A3069;}\n.dark .ct-443230{color:#FFA657;}\n.ct-443230{color:#953800;}"},{"id":"content:2.api:2.devtools.md","path":"/api/devtools","dir":"api","title":"Devtools (beta)","description":"nuxt-mongoose comes with a Nuxt Devtools module that allows you to manage your collections and generate api-endpoints & schemas...","keywords":[],"body":" Devtools (beta) nuxt-mongoose comes with a Nuxt Devtools module that allows you to manage your collections and generate api-endpoints & schemas... Here is a demo video: "}] |