— — — — — — — — — — — — — — — — — — — — — — — — —
Contents
- What is MongoDB?
- Why Should You Use MongoDB?
- What are the Advantages of MongoDB?
- What are the Disadvantages of MongoDB?
- What commands to use MongoDB?
- What purpose to use MongoDB?
- What Languages Support by MongoDB?
— — — — — — — — — — — — — — — — — — — — — — — — —
What is MongoDB?
- MongoDB is a No SQL database. It is an open-source document database that uses a flexible schema to store data and is built on a horizontal scale-out architecture. MongoDB, which was founded in 2007, has a large development community all around the world.
- Each entry in a MongoDB database is a document described in BSON, a binary representation of the data, rather than tables of rows or columns like SQL databases. This data can then be retrieved in JSON format by applications.
Why Should You Use MongoDB?
- To increase the performance of MongoDB searches, indexes can be established.
- With replica sets, MongoDB can achieve high availability.
- MongoDB can be distributed across numerous servers, balancing load and/or replicating data to keep the system up and running in the event of hardware failure.
- Mobile and web app development that is quick and flexible, as well as analytics based on database data.
- IoT (internet of things).
- Flexible Schema Join data from other collections Fast queries Powerful indexing and search Write huge datasets without errors.
What are the Advantages of MongoDB?
MongoDB offers many advantages over traditional relational databases:
- Full cloud-based application data platform.
- Flexible document schemas.
- Widely supported and code-native data access.
- Change-friendly design.
- Powerful querying and analytics.
- Easy horizontal scale-out with sharding.
- Simple installation.
- Cost-effective.
- Full technical support and documentation.
What are the Disadvantages of MongoDB?
- MongoDB uses high memory for data storage.
- There is a limit for document size, i.e. 16mb.
- There is no transaction support in MongoDB.
What datatypes to use MongoDB?
- String:- This is the most commonly used datatype to store the data. String in MongoDB must be UTF-8 valid.
- Integer:- This type is used to store a numerical value. Integer can be 32 bit or 64 bit depending upon your server.
- Boolean:- This type is used to store a boolean (true/ false) value.
- Double:- This type is used to store floating point values.
- Min/ Max keys:- This type is used to compare a value against the lowest and highest BSON elements.
- Arrays:- This type is used to store arrays or list or multiple values into one key.
- Timestamp:- ctimestamp. This can be handy for recording when a document has been modified or added.
- Object:- This datatype is used for embedded documents.
- Null:- This type is used to store a Null value.
- Symbol:-This datatype is used identically to a string; however, it’s generally reserved for languages that use a specific symbol type.
- Date:- This datatype is used to store the current date or time in UNIX time format. You can specify your own date time by creating object of Date and passing day, month, year into it.
- Object ID:- This datatype is used to store the document’s ID.
- Binary data:- This datatype is used to store binary data.
- Code:- This datatype is used to store JavaScript code into the document.
- Regular expression:- This datatype is used to store regular expression.
……………………………………………………………………………………….
Get Saagi Saagish’s stories in your inbox
Join Medium for free to get updates from this writer.
What commands to use MongoDB?
- To start server
mongod- To start client
mongo- Finding the current database you’re in
db- Listing databases
show databases- To create a database / switched to database
use <your_db_name>
eg: use test- Deleting a database
db.dropDatabase()- To create a collection
db.createCollection("<collection_name>")- Inserting data
db.<collection_name>.insertOne()db.<collection_name>.insertMany()
- To find a data in collection and data list with pretty
db.<collection_name>.find()
db.<collection_name>.find().pretty()- To update document
db.<collection_name>.update()- To remove a document
db.<collection_name>.drop()- Limit method
db.<collection_name>.find().limit()- Sort method
db.<collection_name>.find().sort()- Createindex method
db.<collection_name>.createIndex()- Dropindex method
db.<collection_name>.dropIndex()- Dropindexes method
db.<collection_name>.dropIndexes()- Getindexes method
db.<collection_name>.getIndexes()……………………………………………………………………………………….
What purpose to use MongoDB?
- E-Commerce type of product-based applications
- Blog and Content Management systems
- High Speed logging, caching etc in the Real time
- Need to maintain location wise Geospatial data
- For maintains data related to the Social and Networking types
- If application is a loosely coupled mechanism — means design may change at any point of time.
What Languages Support by MongoDB?
MongoDB now supports all popular programming languages
- C
- C++
- Rust
- C#
- Java
- Node.js
- Perl
- PHP
- Python
- Ruby
- Scala
- Go
- Erlang
Who invented MongoDB?
- EA
- Cisco
- Shutter fly
- Adobe
- Ericsson
- Craigslist
- eBay
If you have any questions or suggestions, please send me your comment.
Thank you.






![Questions: You Think You Have Three Different… — Future in Context [Oct01-090848Z·da368f53362a]](https://miro.medium.com/v2/resize:fit:1358/format:webp/1*JQj4gk7YNK10oyBdtnYa2g.png)