DEV Community

Luciano Barreto
Luciano Barreto

Posted on

MongoDB Database Design

Hi! I'm trying to make an app with the MERN Stack, just for practice. What I want to do is an "eCommerce Maker", where the user can create his eCommerce only saving his products and categories. Some time ago I did the same thing in firebase, there i had a collection with an id per eCommerce, this collection had subcollections for categories with products inside. I want to do the same with MongoDB, I don't know a lot of MongoDB, but I came with two "solutions".

  1. Store all the business information (products, categories, etc) in a single document.

  2. Store businesses in a collection, create a "global" collection for categories, and reference the categories in the business collection.

What solution do you recommend me to use? I'm new at this. Thanks!

PD: Sorry for my English, I'm from Argentina xd

Top comments (0)