IceMeltAll
nuxt-mongoose connection uri issue
https://tenor.com/view/imposter-mongoose-among-us-sus-creepy-gif-23645917
Greetings. I'm using a nuxt-ui starter in which I've added nuxt-mongoose among other modules.
My nuxt.config.js file looks like this:
export default defineNuxtConfig({
devtools: {
enabled: true,
timeline: {
enabled: false
}
},
modules: ["@nuxt/ui", "nuxt-mongoose", "@nuxt/content", "@pinia/nuxt", '@nuxt/image'],
compatibilityDate: "2024-09-12",
mongoose: {
uri: 'process.env.MONGODB_URI',
options: {},
modelsDir: 'models',
devtools: true,
},
alias: {
assets: "/<rootDir>/assets",
pinia: "pinia/dist/pinia.mjs",
},
})
No matter what I do to the uri (even though I have compass installed and have personally checked that both the local and the NAS served instance are available) the console keeps returning
ERROR Error connecting to MongoDB: MongoParseError: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"At first, the connection seemed to work. But once I added the '/server/modules' folder or maybe the '/server/middleware' folder, that error appeared and even after removing the folders and cleaning the project, it never went away. my package.json file looks like this:
{
"name": "nuxt-app",
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"devDependencies": {
"@iconify-json/mdi": "^1.2.0",
"@iconify-json/simple-icons": "^1.2.3",
"@nuxt/content": "^2.13.2",
"@nuxt/devtools": "latest",
"@nuxt/image": "^1.8.0",
"@nuxt/ui": "^2.18.4",
"@pinia/nuxt": "^0.5.4",
"nuxt": "^3.13.2",
"nuxt-mongoose": "^1.0.6"
}
}
I feel like giving up on #Nuxt-Mongoose .
How can I properly serve up the connection information for nuxt-mongoose?1 replies