I have this type of data on my server.
[
{
"brand": "Hyundai",
"model": "Pickup -0395",
"price": 80000
},
{
"brand": "Hyundai",
"model": "Sports Car -0305",
"price": 70000
},
{
"brand": "Tesla",
"model": "Sports Car -05",
"price": 180000
},
{
"brand": "Tesla",
"model": "Sedan -95",
"price": 150000
},
{
"brand": "BMW",
"model": "Minivan -0395",
"price": 100000
},
{
"brand": "BMW",
"model": "Sports car -0395",
"price": 90000
}
]
But ,
I want to get single document/product from each brand(property).
2
Answers
You can do something like this if you want to group it by brand on client side
You’d need some criterion for which Hyundai/Tesla/BMW it is. Let’s assume you want the cheapest in any case, you could go for