How to stop MongoDB in Linux
sudo systemctl stop mongod // @Zenonymous
Here is what the above code is Doing:
1. We are creating a new MongoClient object.
2. We are creating a new database called “myFirstMDB”.
3. We are creating a new collection called “customers”.
4. We are inserting a document into the “customers” collection.
5. We are printing out the list of databases on our system.
6. We are printing out the list of collections in our “myFirstMDB” database.
7. We are printing out the documents in our “customers” collection.