普通网友
2019-07-17 12:44
浏览 177

MapReduce中的Golang GlobalSign mgo查询

import "github.com/globalsign/mgo"

job := &mgo.MapReduce{
    Map:    "function() { emit(this.name, 1) }",
    Reduce: "function(key, values) { return Array.sum(values) }",
    Out:    "res",

}

_, err = c.Find(nil).MapReduce(job, nil)

How to add 'query' to the above golang mgo mapreduce ?

Ref:

https://docs.mongodb.com/manual/core/map-reduce/ https://godoc.org/github.com/globalsign/mgo#MapReduce

2条回答 默认 最新

相关推荐 更多相似问题