Collection Schema

Hi,I’m a newbie to MongoDB. My question is when creating a schema, is it better to put all your Documents in a collection to itself, i.e., _ID, doc_type, document. or is it best to embed the document into the collection that contains the medata data for that document, i.e., _iD, doc_type, doc_description, doc_name, document_count, etc.?

Forgive me if examples are too rudimentary.


Hello @William_Jordan,

I am assuming you are looking for database design (or data modeling) information for a certain type of data you have on your mind. The following is the link to documentation for Data Model Design, and it generally discusses:

Effective data models support your application needs. The key consideration for the structure of your documents is the decision to embed or to use references.

You can post specific data and details for more insight into this topic (for example the application data is users, blogs and comments/reviews information or a customer and invoices, etc.).

MongoDB database is Databases and Collections and Documents. And, how you design the data for your application into these is the data modeling.