#No _id
10 messages · Page 1 of 1 (latest)
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
error: ```bash
callback(new MongooseError('document must have an _id before saving'));
^
MongooseError: document must have an _id before saving
at <anonymous> (c:\Users\user\Desktop\Documents\Projects\github\simo-api-funcionando\Botlist-Api\node_modules\mongoose\lib\model.js:305:18)
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
Node.js v18.16.0
Every database entry I’ve ever created requires a ID.
Error speaks for itself
Yes, I know, but there is the _id option which is supposed to disable the creation of a _id property
(Mongoose assigns each of your schemas an _id field by default if one is not passed into the Schema constructor. The type assigned is an ObjectId to coincide with MongoDB's default behavior. If you don't want an _id added to your schema at all, you may disable it using this option.)
the option speaks for itself