Skip to content

Documentation for .group #127

@nilportugues

Description

@nilportugues

Hello.

I managed to code a full library using this library (https://github.com/nilportugues/php-mongodb-repository)... but I haven't managed to do get this running:

db.book_facets.group({
    "key": {
        "facetName": true,
        "facetValue": true
    },
    "initial": {
        "total": 0
    },
    "reduce": function(obj, prev) {
        if (obj.facetValue != null) if (obj.facetValue instanceof Array) prev.total += obj.facetValue.length;
        else prev.total++;
    }
});

Any clues or better documentation on how to run this?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions