juniorMongoDB
Explain the concept of Collections.
Updated May 1, 2026
Short answer
A collection is a grouping of MongoDB documents, equivalent to a table in an RDBMS.
Deep explanation
Collections do not enforce a strict schema, meaning documents within a collection can have different fields. However, they usually share a similar purpose.
Real-world example
Grouping all user-related data into a 'users' collection.
Common mistakes
- Creating too many collections (namespace overhead).
Follow-up questions
- Can collections have schemas?