If you are thinking of getting started with MongoDB, then you are at right place. So first you might ask why MongoDB?
Why MongoDB?
- It is a No-SQL Database, highly flexible in terms of schema and data
- Highly performant in terms of amount of data and traffic
- Backed by a great community
- Helps your data and deployment to evolve with changing Business Needs
What else I have missed? Mention in the comments section.
Getting Started
Once MongoDB is installed and running.
Use mongo
shell. Just open up your terminal and enter mongo
. You will be presented with Mongo Shell.
If you have turned on Authentication then use the following parameters to the mongo
command.
This will prompt you for the password.
Now you can view list of all databases using show dbs
command.
You switch to whichever db you want or even create a new db.
You can see list of collections in the current database using simple command
show collections;
What are collections in MongoDB?
They are simply group of objects which represent something similar. For analogy, its just like a Table / Relation in a Relational Database like MySQL.
What are documents?
Documents are to MongoDB what Row is for Relational Database. Documents are nothing but collection of key value pairs(actually more than that, but this is what you should know for now).
Your Thoughts?
That's it for this post guys. Let me know about your doubts on MongoDB in comments or visit appsyoda.dev