Database IntegrationLesson 61Free preview
MongoDB Collection
This lesson is part of Node.js · All levels
Summary
This lesson discusses collection as a document container in MongoDB, equivalent to a table in RDBMS but without a strict scheme. You learn to create an explicit collection with createCollection, look at a list of collections with listCollections, and delete a collection. New documents also automatically create a collection when first stored.
Key points
- A collection is a collection of documents; made explicitly via db.createCollection(name).
- Db.listCollections() restores the existing metadata collection.
- CreateCollection options such as {capped: true} or validators add rules to the collection.
- Drop collection permanently deletes all documents and indexes in it.
- Collections are schemaless: the structure of documents may vary within a collection.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.