Data Structure General Question

Hi friends,

I’m currently putting together a data structure for a new application I’m putting together and a really basic question I have is regarding grouping data within a document. By this I mean putting together a structure like this:


Rather than


When I’m looking at the data in my collection it would certatinly be simpler if I can group the data together as in the first example.

Are there any downsides to this? Does it slow down performance? Is there any documentation I can be pointed to that will help me make an informed choice?



I’ve had a look at MongoDb documentation on sub-document querying and can’t find anything that says you shouldn’t do it or that it has negative impacts on performance, sorry I’ve phrased my original message so poorly.

Hi @Chris_Boot1 and welcome to MongoDB community forums!!

A general rule of thumb while doing schema design in MongoDB is that you should design your database in a way that the most common queries can be satisfied by querying a single collection, even when this means that you will have some redundancy in your database. Thus, it may be beneficial to work from the required queries first, making it as simple as possible, and let the schema design follow the query pattern. You can read more about Data Modelling and Query Performance to understand further.

From the above two schema shared, the former displaying use of Embedded Documents and the later a plain document which contains all data into a single field.

The performance would completely depend on your specific use case and application requirement. However, to understand better, you can visit the documentation to understand the difference between Model One-to-One Relationships with Embedded Documents and Model One-to-Many Relationships with Embedded Documents.

Also, to understand better, I would recommend you taking up Introduction to MongoDB Data Modelling-MongoDB University for more clear understanding.

Let us know if you have any further questions.


1 Like