About database Design

Hello EveryOne i am working on project where i have collection of product where user can create a custom request/offer on product price so what will be the best approach should i add the offer collection as array or should i create a separate collection for it and save data based on product Idb
Thanks in advance

Hi Abis!

In MongoDB, the query patterns and usage of the data should drive the database model. From what you’re saying, it looks like “Offers” are used separately from “Products”. This means that they’re a standalone entity and should have their own collection. If you’re working regularly with “Offers” outside of the context of “Products” it will be much easier to query a collection of “Offers” than a nested array.