How can i design a database for my website using mongoDB

Advertisements

I just want..

Collection

  • Signup
  • admin
  • products
  • cart
  • orders
  • payments
  • stocks

What is the better way to linked each other and optimized my database.

>Solution :

In mongoDB you have by Default ID. so you can use it to link collections each other.

  • you do not need to make 2 collections for signup and admin.just add one field in single collection.
{
email,
password,
role
}
  • Also you can set userID to cart and Payment collection to get particular user data.
Cart collection.
{
   itemname,
   itemID,
   price,
   userID
}
  • Use can make payment and order collection like cart collection.
    Thank you!

Leave a Reply Cancel reply