How to execute aggregated request in mongodb client on RockMongo or mViewer

I just started using mongo db, I am using the rockmongo client and my ubuntu terminal as another client. I fulfilled the query using group aggregation as follows:

 db.archiveImpl.group(
 {
   key: {accountID: true, phone: true },
   cond: {'userId': "oiuoifas2309u"},
   reduce: function(object, prev){ },
   initial:{}

 }

)

And the above request does not start in rockmongo, initially I thought the request was wrong. and I went into the terminal, which delivered the data to me. So I downloaded and installed mViewer, and it didn't work either, so I believe there is a way to run such requests in mongo web clients.

thanks for this.

+5
source share
1 answer

"tools- > command" rockmongo. :

{ 
  aggregate : "ns",                                          
  pipeline : [
               ...
             ]                
}

! , !

:

{ aggregate : "COLLECTION_NAME",
  pipeline : [
    { $unwind : "$SUB_ARRAY" },
    { $match: {"SUB_ARRAY.field": "value"}},
  ]
}
+9

All Articles