Nuxt-Mongoose
Hi,
I am experiencing an issue with the nuxt-mongoose framework. I am attempting to locate a document in the MongoDB database collection that matches a specific key/field called kinde_id, but I keep receiving an error. Please refer to the attached images above to view the code. I can retrieve (find) documents that match the _id quite alright but kinde_id doesn't work.
Could anyone help out with this issue?
This is the error I am getting:
4 Replies
bump
Are you importing your
userModal
in your index.get.ts?Hi, yes it gets auto imported.
I figured out the solution
My Schema/Modal is incorrect
how is your nuxt-mongoose connection to instance set up? Initially for me it was working using .env and configuring it in nuxt.config.ts like this
mongoose: {
uri: 'process.env.MONGODB_URI',
options: {},
modelsDir: 'models',
devtools: true,
},
but once I started adding /server/methods and /server/middleware the console when running npm run dev keeps outputing
ERROR Error connecting to MongoDB: MongoParseError: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"