Databases getting deleted on system restart

I am using MongoDB community edition on my localhost Ubuntu machine. But every time I restart my system, the databases I created previously are gone.

How to prevent this?

That is very unlikely if it is installed correctly, started correctly and terminated correctly.

How do you start mongod?

How do you create your databases? mongosh? java program? nodejs program?

How do you verify that the databases are created correctly?

Can you share a screenshot of running mongosh that shows the content of one of your database?

I start mongod by using sudo systemctl start mongod , I create database using mongosh.

This is the output I get after using mongosh command:

Current Mongosh Log ID: *************
Connecting to:          mongodb://
Using MongoDB:          6.0.3
Using Mongosh:          1.6.0

For mongosh info see:

   The server generated these startup warnings when booting
   Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See
   Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
   vm.max_map_count is too low

   Enable MongoDB's free cloud-based monitoring service, which will then receive and display
   metrics about your deployment (disk utilization, CPU, operation statistics, etc).
   The monitoring data will be available on a MongoDB website with a unique URL accessible to you
   and anyone you share the URL with. MongoDB may use this information to make product
   improvements and to suggest MongoDB products and deployment options to you.
   To enable free monitoring, run the following command: db.enableFreeMonitoring()
   To permanently disable this reminder, run the following command: db.disableFreeMonitoring()

This is how I am creating a database:

use shop
switched to db shop
shop> db.products.insertOne({"productName": "A Computer"})
  acknowledged: true,
  insertedId: ObjectId("637b23fcc334f2258856a")
shop> db.products.find()
    _id: ObjectId("637b23fcc334f2258856a"),
    productName: 'A Computer'

But when I restart my PC the shop database is gone.

Restarting mongod will not delete dbs
Show output of show dbs.Restart and show output of the same command again
Also your mongod is running with access control disabled
Try to secure your mongod with --auth and check if you are observing same behaviour

I am also getting the same issues, i am using a sandalone vm with mongodb installed. I import the collections and databases with auth (password,username) . After restart all collections got deleted but the databases with auths are there, again i have to import the collections to see my fields. please help with that , i am using vm with disk 10 10 gb and using f1 small mechine because of less data.