I just want..
Collection
- Signup
- admin
- products
- cart
- orders
- payments
- stocks
What is the better way to linked each other and optimized my database.
CodePudding user response:
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!
CodePudding user response:
Need more clarity around problem statement. But for starters, you can use a sign up ID, which can be used as primary key and can be used to link collections.