MongoDB Design for eCommerce app

28 views
Skip to first unread message

G.H. Naylor

unread,
Jul 2, 2013, 10:20:37 PM7/2/13
to mongoo...@googlegroups.com
I'm new to MongoDB and NoSQL in general, and I'm having a bit of trouble designing my database. I'm looking for some guidance on how to structure my documents. Here are my requirements...
  • Stores can sell products
    • Stores define zip codes in an array where they are willing to deliver to
    • Stores define hours they are open
    • Stores have tags such as "delivery only", "pickup only", "delivery or pickup - depends on product", "wheel chair accessible", "takes cash", "takes credit card", and other tags
  • Products
    • Are available for pickup, delivery, or both. 
    • Will have user reviews (probably wont ever get more than 1000 reviews per product)
    • Has tags/categories. These will be predefined, but might need to be extensible in the future.
I don't foresee stores ever selling more than 1,000 products.

I need to be able to run the following example searches:
  • Show all products available for delivery to Los Angeles, CA that have x, y, and z tags. Only show products from stores that are open right now
  • Show all stores within x miles of Los Angeles, CA that offer pick-up and/or delivery and/or "inser-tag-here", etc.. Only shows stores that are open right now.
    • I will use a service like google maps to find other zip codes that are within x miles of Los Angeles
Hopefully this fully explains my situation in a clear manner. I could really use some feedback on this! I suppose in MySQL et al I woud use a join for these searches. But alas, no joins in Mongo. 

Maybe I should be using sub documents? Or should I just throw all the products along with reviews into each Store document? Should I bet worried about the 16MB limit?

You're still reading... Good! Thanks in advance for your reply :)
Reply all
Reply to author
Forward
0 new messages