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
Skip to main content
26 days later
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.
New & Unread Topics
Topic | Replies | Views | Activity |
---|---|---|---|
Index bounds on embedded field | 0 | 429 | May 2024 |
How to Efficiently Rename a Field Across 1 Million MongoDB Documents? | 1 | 693 | Jul 2024 |
How to Manage User Relations (Following/Follower/Friend) | 0 | 248 | Aug 2024 |
Problem filtering an array, cond if field is null does not work | 2 | 86 | Oct 2024 |
Is there performance difference between multiple “$set” and a single “$set” | 0 | 36 | Dec 2024 |