MongoDB Collection

A collection is equivalent to an RDBMS table. It store number of documents inside it. Since MongoDB is schema less, collection do not have schemas. We can store any number of documents in single collection and all of them have related purpose.

You can create a collection using the createCollection() database method.

Syntax :

db.createCollection("collection_name")

Output:

Create Collection Using createCollection() Method

You can also create a collection while inserting document :

db.collection_name.insertOne(document_object)

Create Collection by Inserting Record Into It.

It will create if not already exists.

To show all the collections use show collections comman

Get all the Collections

MongoDB Terminology

MongoDB is Open Source, Document-oriented, and Schema which means we don’t need to worry about the structure before inserting data into the database. It is a NoSQL database. It stores data in a non-tabular format. Using NoSQL, we can maintain flexible schemas and these schemas can be scaled easily with large amounts of data.

MongoDB was founded in 2007 by Dwight Merriman, Eliot Horowitz, and Kevin Ryan. The first major version of MongoDB, version 1.0, was released in February 2009. The first version of the database was shipped in August 2009.

Similar Reads

Need for MongoDB

MongoDB is used for handling Big Data. MongoDB is used for storing and modeling structured, semi-structured, and unstructured data. Where scalability is the considerable factor, MongoDB is used. MongoDB is a Non-Relational database hence can scale out better than relational databases and these can be designed with real-life applications.applications For the efficient execution of a database with high availability, MongoDB is used....

Features of MongoDB

MongoDB is a Scheme-less, document-based database system. MongoDB doesn’t follow any relational model. It is either schema-free or has a relaxed schema. That means it does not require a specific definition of a schema.the MongoDB can process both structured and semi-structured databases. MongoDB is highly scalable, hence widely used. MongoDB cost efficient. MongoDB provide high performance. MongoDB supports data in form of key-value pairs. MongoDB provides horizontal scalability with the help of sharding. (sharding means to distribute data on multiple servers)...

Some Common Terms Used in MongoDB

Data...

Sharding in MongoDB

Sharding is concept in MongoDB, which help achieve distribution of data into different locations. This is a method in which data is allocated across multiple machines. It allows horizontal scaling. Sometimes the data required by the request is more larger than the RAM of the server and hence it is mandatory to serve request and provide appropriate data. hence to achieve the Data Availability Database is broken down and stored over multiple servers. By Implementing sharding, we can increase volume and response throughput by just adding servers....

MongoDB Collection

A collection is equivalent to an RDBMS table. It store number of documents inside it. Since MongoDB is schema less, collection do not have schemas. We can store any number of documents in single collection and all of them have related purpose....

MongoDB Document

It is a basic unit of data in MongoDB. document is set of key value pairs. It is a record which is being inserted in the collection. It may be already existing data in the collection. we insert documents in the form of JSON. document can have flexible schema that means different documents in collection do not need to have same set of fields or structure....

MongoDB Field

Field is key-value pair which is base of inserting data into documents. documents can have any number of fields. it can have zero or more fields. it is same as columns in RDBMS....

MongoDB _id

_id is a special key present in the document. it is used to uniquely identify the document. _id is automatically generated by the MongoDB. we can’t change the value to this field....

Conclusion

Overall, We have also seen that the need of MongoDB and some basic terms which are frequently used in MongoDB to perform operations. We sum each and every terminology with the example also compared the MongoDB terminologies with the RDBMS terminologies. Mongodb is a NoSQL database which is used to handle complex, large and uncomplicated data in very easy way....