有个功能,经常要根据工厂id查询数据,请问下面哪种设计比较合理?
还是说,效率都一样?
方案1:
{
{ "_id" : 1, "product" : "产品1", "price" : 5.5, "quantity" : NumberInt(5), "factory":"工厂1" }, { "_id" : 2, "product" : "产品2", "price" : 5.5, "quantity" : NumberInt(5), "factory":"工厂1" }, ..... .....
}
方案2:
{
"factory":"工厂1", "list":[ { "_id" : 1, "product" : "产品1", "price" : 5.5, "quantity" : NumberInt(5), }, { "_id" : 2, "product" : "产品2", "price" : 5.5, "quantity" : NumberInt(5), }, .... .... ]
}
相关分类