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:
You can also create a collection while inserting document :
db.collection_name.insertOne(document_object)
It will create if not already exists.
To show all the collections use show collections comman
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.