{"repo":"nuxtaid/nuxt-mongoose","free":true,"listed":false,"github":"https://github.com/nuxtaid/nuxt-mongoose","clone":"git clone https://github.com/nuxtaid/nuxt-mongoose.git","description":"A Nuxt module for simplifying the use of Mongoose in your project.","language":"Vue","stars":96,"topics":["mongodb","mongoose","nuxt"],"license":null,"category":"data-pipelines","readme_excerpt":"Nuxt Mongoose A Nuxt module for simplifying the use of Mongoose in your project. Installation Usage Setup Add nuxt-mongoose to the modules section of your nuxt.config.ts file. Configuration You can configure the module by adding a mongoose section to your nuxt.config file: By default, nuxt-mongoose will auto-import your schemas from the models directory in the server directory. You can change this behavior by setting the modelsDir option. --- 🛠️ Quick Setup Without Configuration If you prefer to use the default configuration, skip adding the mongoose section to your nuxt.config.ts file. Simply provide your MongoDB connection URI in a .env file like this: 🔹 Replace username , password , and with your MongoDB credentials and database name. That's it! The module will automatically use the NUXT MONGOOSE URI and default settings for your connection. No additional configuration is required. --- For more details about connection options, check out the Mongoose documentation. API defineMongooseConnection This function creates a new Mongoose connection. Example usage: defineMongooseModel This function creates a new Mongoose model with schema. Example usage: or you could use it like: Connecting to an Existing Collection If you need to connect to an existing collection in the database, you must specify the collection name using the options field. Otherwise, Mongoose will create a new collection based on the model name. --- Important Notes - Using the options.collection field ensures t","default_branch":null,"files":null,"tree":[],"storefront":"/r/nuxtaid","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/nuxtaid/nuxt-mongoose/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}