Lessons
MongoDB Introduction
MongoDB Installation & Setup
MongoDB Create Database & Collections
MongoDB mongosh Collections
What is Collections in MongoDB:
MongoDB stores data records as documents (specifically BSON documents) which are gathered together in collections.
You can manage databases and collections on the Atlas cluster from the Atlas UI,
mongosh, or MongoDB Compass.Create Collection using mongosh
You can create a collection using the
createCollection() database method.Example:
db.createCollection("students")For example school is a database name & students is a collection name.
Show or List Collections using mongosh
You can show or list collection using the
show collections or db.getCollectionNames() method.Example:
show collections
or
db.getCollectionNames()
or
How to rename Collection name in mongosh
You can rename a collection using the
renameCollection() method.Example:
db.students.renameCollection("student")Course Lessons
MongoDB Introduction
MongoDB Installation & Setup
MongoDB Create Database & Collections