Posted under » MongoDB on 1 January 2024
Installing MongoDB on Ubuntu was a breeze.
You can see that it was installed at /var/lib/mongodb.
The config files are at /etc/mongod.conf
MongoDB is not autostart by default but you can start it by
Check status
$ systemctl status mongod
To stop and start
$ service mongod start
If you feel like to start automatically,
$ systemctl enable mongod
Begin using MongoDB. Start a mongosh session on the same host machine as the mongod. You can run mongosh without any command-line options to connect to a mongod that is running on your localhost with default port 27017.
$ mongosh test» show dbs admin 40.00 KiB config 60.00 KiB local 72.00 KiB
In MongoDB default database is test. If you didn't create any database, then collections will be stored in test database.
If you wish to backup and export data.