Help modeling my product DB

Hi @tmmsdlczek,

Welcome to MongoDB community!

It sounds like a classic online store schema that you are looking for where products collection will probably be the main one. I would recommend keeping as minimum amount of collections as possible therefore embedding as much as possible into the product document sounds correct.

Of course data must be also logically segregated according to the application access patterns. I think a following document might be good fit:

{
ProductId: ....,
ProductName: ...,
Category: [ ... ],
Markets : [ { marketId: ... , MarketName : ...}...]
...
}

I assume there will still be catagories and market collections but you can still index category and markets fields to search products solely on products collection…

Also read the following blog

Best
Pavel

1 Like