How does Mongodb implement groupby-like operations

  mongodb, question

I am using Mongodb’s php driver.https://docs.mongodb.com/php- …
There is an operation similar to groupby, which I do not know how to write. For example, there is a set below:

$cities=[
 ['id'=>'xxx','city'= >' Shenzhen',' provision' = >' Guangdong',' provision _ number' = >' 44'],
 ['id'=>'xxx','city'= >' Guangzhou',' provision' = >' Guangdong',' provision _ number' = >' 44'],
 ['id'=>'xxx','city'= >' Hangzhou',' provision' = >' Zhejiang',' provision _ number' = >' 33'],
 ['id'=>'xxx','city'= >' Nanjing',' provision' = >' Jiangsu',' provision _ number' = >' 32'],
 ['id'=>'xxx','city'= >' Suzhou',' provision' = >' Jiangsu',' provision _ number' = >' 32'],
 ['id'=>'xxx','city'= >' Chengdu',' provision' = >' Sichuan',' provision _ number' = >' 51'],
 ['id'=>'xxx','city'= >' Mianyang',' provision' = >' Sichuan',' provision _ number' = >' 51'],
 ];

Demand is to put insideprovinceAndprovince_numberTake it out and store it in another set. These two words are repeated. Just take one, that is, the effect of groupby in mysql. How should you write it?

I checked on the Internet and it seems to be in line with the effect you want:http://blog.csdn.net/lff0305/ …