database is not cnnecting in the server.js file
MongoParseError: option usecreateindex is not supported
at parseOptions (G:Aziibella Surgicalnode_modulesmongodblibconnection_string.js:273:15)
at new MongoClient (G:Aziibella Surgicalnode_modulesmongodblibmongo_client.js:52:63)
at NativeConnection.createClient (G:Aziibella Surgicalnode_modulesmongooselibdriversnode-mongodb-nativeconnection.js:293:14)
at NativeConnection.openUri (G:Aziibella Surgicalnode_modulesmongooselibconnection.js:801:34)
at Mongoose.connect (G:Aziibella Surgicalnode_modulesmongooselibmongoose.js:414:15)
at connectDatabase (G:Aziibella Surgicalbackendconfigdatabase.js:5:6)
at Object. (G:Aziibella Surgicalbackendserver.js:12:3)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32) {
[Symbol(errorLabels)]: Set(0) {}
}
Project validation failed: tasks : Cast to [undefined] failed for value “[]” (type string) at path
I have been working on a project management tool. I created a mongoose schema for the Project. But when I test it using Postman it throws an error. I tried almost everything and spent hours debugging but all in vain. Here is the exact error:
Project validation failed: tasks: Cast to [undefined] failed for value "[]" (type string) at path "tasks.0" because of "TypeError
Project validation failed: tasks : Cast to [undefined] failed for value “[]” (type string) at path
I have been working on a project management tool. I created a mongoose schema for the Project. But when I test it using Postman it throws an error. I tried almost everything and spent hours debugging but all in vain. Here is the exact error:
Project validation failed: tasks: Cast to [undefined] failed for value "[]" (type string) at path "tasks.0" because of "TypeError
User.create is not a function in Mongoose despite correct schema definition
I’m encountering an issue where I’m receiving the error “User.create is not a function” in my Node.js application using Mongoose, despite having what appears to be a correctly defined schema. Here’s my userModel.js:
Mongoose error while trying to create a new document
here is the mongoose version im using “mongoose”: “^8.3.2”
and here is the full code
Error message when using the mongoose Model.create() method
i tried to create a document using