there is a function that often needs to query data according to the factory id. Which of the following designs is more reasonable?
or is the efficiency the same?
scenario 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"
},
.....
.....
}
scenario 2:
{
"factory":"1",
"list":[
{
"_id" : 1,
"product" : "1",
"price" : 5.5,
"quantity" : NumberInt(5),
},
{
"_id" : 2,
"product" : "2",
"price" : 5.5,
"quantity" : NumberInt(5),
},
....
....
]
}