{"action":"created","issue":{"url":"https://api.github.com/repos/agmen-hu/node-datapumps/issues/30","repository_url":"https://api.github.com/repos/agmen-hu/node-datapumps","labels_url":"https://api.github.com/repos/agmen-hu/node-datapumps/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/agmen-hu/node-datapumps/issues/30/comments","events_url":"https://api.github.com/repos/agmen-hu/node-datapumps/issues/30/events","html_url":"https://github.com/agmen-hu/node-datapumps/issues/30","id":135952440,"number":30,"title":"Using the group method on MongoDbMixin","user":{"login":"sfhorton01","id":14168936,"avatar_url":"https://avatars.githubusercontent.com/u/14168936?v=3","gravatar_id":"","url":"https://api.github.com/users/sfhorton01","html_url":"https://github.com/sfhorton01","followers_url":"https://api.github.com/users/sfhorton01/followers","following_url":"https://api.github.com/users/sfhorton01/following{/other_user}","gists_url":"https://api.github.com/users/sfhorton01/gists{/gist_id}","starred_url":"https://api.github.com/users/sfhorton01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfhorton01/subscriptions","organizations_url":"https://api.github.com/users/sfhorton01/orgs","repos_url":"https://api.github.com/users/sfhorton01/repos","events_url":"https://api.github.com/users/sfhorton01/events{/privacy}","received_events_url":"https://api.github.com/users/sfhorton01/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-24T04:38:32Z","updated_at":"2016-02-24T09:50:40Z","closed_at":null,"body":"When using the MongoDbMixin to read data, I need to be able to perform a group or aggregate first.  So what I have is something like:\r\n```javascript\r\neventsPump.mixin(MongodbMixin(...))\r\n      .useCollection('sites')\r\n      .from(eventsPump.group(['status.description'], {type: 'Master'},\r\n        { sites : 0, transactions: 0 },\r\n        function (curr, result) {\r\n          result.sites++;\r\n          if (curr.metricsSummary) {\r\n            result.transactions += curr.metricsSummary.transactions.count;\r\n          }\r\n        }\r\n      ))\r\n...\r\n```\r\n\r\nHowever, I am getting an error on the .from line: \r\n```\r\nError: Argument must be datapumps.Buffer or stream\r\n    at Pump.module.exports.Pump.from (/web/gstv-server-apps-reports/node_modules/datapumps/lib/Pump.js:94:15)\r\n```\r\n\r\nAm I doing something wrong? Or is this not really supported?\r\n"},"comment":{"url":"https://api.github.com/repos/agmen-hu/node-datapumps/issues/comments/188169460","html_url":"https://github.com/agmen-hu/node-datapumps/issues/30#issuecomment-188169460","issue_url":"https://api.github.com/repos/agmen-hu/node-datapumps/issues/30","id":188169460,"user":{"login":"novaki","id":1231238,"avatar_url":"https://avatars.githubusercontent.com/u/1231238?v=3","gravatar_id":"","url":"https://api.github.com/users/novaki","html_url":"https://github.com/novaki","followers_url":"https://api.github.com/users/novaki/followers","following_url":"https://api.github.com/users/novaki/following{/other_user}","gists_url":"https://api.github.com/users/novaki/gists{/gist_id}","starred_url":"https://api.github.com/users/novaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novaki/subscriptions","organizations_url":"https://api.github.com/users/novaki/orgs","repos_url":"https://api.github.com/users/novaki/repos","events_url":"https://api.github.com/users/novaki/events{/privacy}","received_events_url":"https://api.github.com/users/novaki/received_events","type":"User","site_admin":false},"created_at":"2016-02-24T09:50:40Z","updated_at":"2016-02-24T09:50:40Z","body":"Unfortunately the `.group()` method is not wrapped in the pump. A quick a workaround could be to call group on mongo collection directly:\r\n```coffee\r\neventsPump._mongo.collection.group(<your args here>).stream()\r\n```\r\nPlease note a `stream()` call after grouping. Input buffers of pumps must be streams, arrays or datapumps Buffers."}}