cl-mongo icon indicating copy to clipboard operation
cl-mongo copied to clipboard

can't read the mapreduce results

Open paulogeyer opened this issue 10 years ago • 1 comments

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 }

paulogeyer avatar Aug 10 '14 22:08 paulogeyer

I can confirm exactly the same problem while reading "Lisp for the Web" :smiley: Problem still seems to exist. I assume it's because of a change in mongodb as cl_mongo hasn't seen development in some time. :disappointed: If my lisp skills would be better I would have a look at the internals.

cb0 avatar Jan 26 '16 18:01 cb0