Mongodb schema design

前端 未结 2 1994
再見小時候
再見小時候 2021-01-14 10:53

I\'m confused, what is the best format for the following case:

Name: Pretty nice hot dog
Stock: 10
Weight: 0.1 grams
Price: 2 dollars

Name: An ordinary dumb         


        
相关标签:
2条回答
  • 2021-01-14 11:04

    Read Schema Design from MongoDb docs. This is exactly your case.

    0 讨论(0)
  • 2021-01-14 11:17

    I'd say no. Unless you need the flexibility to query from the units (all items with a certain cost), I wouldn't. And if you need to, you can always use map reduce to get all items of a certain cost later on.

    0 讨论(0)
提交回复
热议问题