Reputation: 803
I'm new to MongoDB and I want to design schema for eCommerce Website. I only ask about one example and I hope it will help me for the whole design.
Requirements:
I consider some options:
What are the pros and cons? Is there another way to design this?
Any example will be helpful, thanks!
Upvotes: 0
Views: 472
Reputation: 3353
//item
{
_id : Number,
name : String,
price : Number
}
//user
{
_id : Number,
name : String,
profile : {
location : String,
age : Number,
created_at : Date,
/*something something something*/
},
wishlist : {
item_id : [Number] // store item's _ids
}
}
I don't think using Database to store the cart data is common way. usually you can use session/get/post/cookie instead
Upvotes: 1