From the course: Learning MongoDB

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Collections

Collections

- [Instructor] While the flexibility of MongoDB's document model has many advantages for developers, keeping those documents organized can become trickier. That is where collections come in. As we store more and more of our site's data in MongoDB, inevitably some of that data will be distinctly different. Take these documents for example, we have a Recipe, a Blog Post and a User account. Now, we could store these all together by having maybe a type field and mark it as recipe or a post or user, but at some point, that's going to not only become somewhat annoying but it can cause performance problems. With collections however, we can keep related documents grouped together for simpler organization and better performance. You can think of collections, somewhat like tables in a relational database, but not all the documents need to have the same schema or structure. The collections themselves are then stored inside…

Contents