Python MongoDBLesson 126Free preview
MongoDB Collection
This lesson is part of Python · All levels
Summary
This lesson discusses the collection as a container of documents in MongoDB, which is equivalent to a table in a relational database. Collections can be automated when inserted or explicit with create_collection, then checked using list_collection_names(). Unnecessary collection can be deleted with drop_collection().
Key points
- A collection is a collection of BSON documents and is similar to a table in MySQL.
- Access collection with db["name"] or db.nama, which automatically creates it when it doesn't exist.
- Create_collection() creates a collection explicitly without directly entering data.
- List_collection_names() displays all collections in a database.
- Delete the collection along with all documents and indexes in it.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.