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

Install MongoDB server on Fedora command

sudo vi /etc/yum.repos.d/mongodb.repo

name=MongoDB Repository

sudo dnf update
sudo dnf install mongodb-org
sudo systemctl enable mongod.service
sudo systemctl start mongod.service
mongod --version

> use test;
switched to db test
WriteResult({ "nInserted" : 1 })
> db.test.find()
{ "_id" : ObjectId("5f82b166af5d9be8c5bd0449"), "hello" : "world" }
Add to my src(0)

No account yet? Register

Install Mongodb server on Debian / Ubuntu

sudo apt-get install gnupg
wget -qO - | sudo apt-key add -
echo "deb buster/mongodb-org/4.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo systemctl daemon-reload
sudo systemctl start mongod
sudo systemctl status mongod
sudo systemctl enable mongod

sudo systemctl stop mongod
sudo systemctl restart mongod
Add to my src(0)

No account yet? Register