Mongoose save() not working/saving

If save() does not save the entity to mongodb database, probably there’s something wrong with the data itself like containing _id field

delete data._id; //clean up to ensure no _id field.
let user = new User(data);;

Also it is better to provide error handling so we can read what went wrong using the log.

let user = new User(data); (err) {
            if (err) {
Add to my src(1)

No account yet? Register

Spread the love

Leave a Comment