Skip to content

can't read the mapreduce results #22

@paulogeyer

Description

@paulogeyer

this is my code

(defjs map_category()
  (emit this.category 1))

(defjs sum_games(c vals)
  (return ((@ Array sum vals))))

(defun sum-by-category ()
  (cl-mongo:pp (cl-mongo:mr.p ($map-reduce "game" map_category sum_games))))

when I execute sum-by-category, it returns nil

RETRO-GAMES> (sum-by-category)

NIL
RETRO-GAMES> 

but when I run the same code directly in the mongodb,

> db.game.mapReduce(map_category, sum_games, {out: "map_reduce_example"})
{
    "result" : "map_reduce_example",
    "timeMillis" : 6,
    "counts" : {
        "input" : 3,
        "emit" : 3,
        "reduce" : 1,
        "output" : 2
    },
    "ok" : 1,
}
> db.map_reduce_example.find()
{ "_id" : "Classic", "value" : 1 }
{ "_id" : "Strategy", "value" : 2 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions