SQL to MongoDB - Doubt (beginner)

Hi guys!
Previously I have worked with relational databases and I am new with mongo, so I am having a little bit of trouble understanding how to transform a database in relational model to mongoDB.
The main doubt is about the weak entities, how do you represent weak entities in mongoDB. Should it be a collection, or some kind of embedded sub document?
For example, if I have (in relational model) an entity Method with a weak entity Experiments connected to it (representing the experiments we have done using the Method); how should I transform it to mongo?
I was thinking about creating a collection Method and embedding Experiments to it.
But I am not really sure if this is the way.

Hope you guys can guide me a little bit!

Hello @Adi_Lubos, Welcome to the MongoDB Community forum!

The weak entity relationship is a one-to-many (in this case). The way to model this is with Embedded Documents as an array field.


    id: 1234,
    description: 'Data Modeling Exercise',
    experiments: [
        { id: 1, name: 'Build relationships' },
        { id: 2, name: 'Draw diagrams' },



Hi @Adi_Lubos ,

So the general assumption with MongoDB is that related data that is queried together should be stored together.

So if for every method your application needs to have the related experiments they should be embedded if they are not crossing a large amount per document.

If that happens you need to perhaps define a spliting factor into multiple documents , like a monthly range of expriments per method or something of that sort.I would say that you should keep the number of embedded experiments in the array below ~500 …

Now if for some reason you might need to query expriments unrelated to methods you may consider splitting them into a separate collection and adding a methodId to each document, if this field is indexed you can have 2 queries to gather full expriments per method information …

I recommend reading the following