Skip to content

Using the group method on MongoDbMixin #30

@sfhorton01

Description

@sfhorton01

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:

eventsPump.mixin(MongodbMixin(...))
      .useCollection('sites')
      .from(eventsPump.group(['status.description'], {type: 'Master'},
        { sites : 0, transactions: 0 },
        function (curr, result) {
          result.sites++;
          if (curr.metricsSummary) {
            result.transactions += curr.metricsSummary.transactions.count;
          }
        }
      ))
...

However, I am getting an error on the .from line:

Error: Argument must be datapumps.Buffer or stream
    at Pump.module.exports.Pump.from (/web/gstv-server-apps-reports/node_modules/datapumps/lib/Pump.js:94:15)

Am I doing something wrong? Or is this not really supported?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions