Skip to content

Group by field #102

Closed
Closed
@FrEaKmAn

Description

Hello

I'm interested how to run this query

    db.parties.group({
            key: { start: 1 },
            cond: { start: { $gt: new Date( '01/01/2012' ) } },
            $reduce: function ( curr, result ) { result.count++ },
            initial: { count : 0 }
    });

I tried with

    MapReduceCommand command = new MapReduceCommand(Party.col(), "{ start: 1 }", "function ( curr, result ) { }", "count", MapReduceCommand.OutputType.REPLACE, null);
    MapReduceOutput output = Party.col().mapReduce(command);

But I always get 0 results. Any ideas how to make it work?

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