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)
如何将“查询”添加到上面的 golang mgo mapreduce ?
参考:
https://docs.mongodb.com/manual/core/map-reduce/ https://godoc.org/github.com/globalsign/mgo#MapReduce
茅侃侃
暮色呼如
相关分类