sql >> Base de Datos >  >> NoSQL >> MongoDB

Cómo usar Agregado en mangosta

Prueba esto

Contacts.aggregate({$group: { "_id": { code: "$Code", name: "$Name" } } }, function(err, contacts) {
   ...
});

O, con $match si necesita esta AgencyTranslation: /^BROADCASTING/ condición

Contacts.aggregate([
  { $match : { AgencyTranslation: /^BROADCASTING/ } },
  { $group: { "_id": { code: "$Code", name: "$Name" } } }
], function(err, contacts) {
  // ...
});