I am new MongoDB. I have a table like this below.
I would like to get the list of product categories who has minimum price within that category and their count.
ProdName PrdCategory PrdPrice
PrdB 34 8
PrdA 34 50
PrdC 134 49
PrdD 134 50
PrdE 34 8
My SQL works fine as shown below.
select PrdCategory, min(PrdPrice), count(*) from ProdTable
group by PrdCategory
order by PrdPrice, PrdCategory
My answer at SQL was:
PrdCategory min(PrdPrice) count
34 8 2
134 49 1
How will I get the same results with MongoDB, with a collection similar to ProdTable?