mongodb 跑mapreduce 遇到问题:Mongodb cannot run map reduce without the js engine
参看一下下面的解决:
https://stackoverflow.com/questions/40179448/mongodb-cannot-run-map-reduce-without-the-js-engine
https://docs.mongodb.com/v3.2/reference/configuration-options/#security.javascriptEnabled
遇到这个问题的,去看看mongodb的配置文件,是不是更改了一些默认配置造成的
js engine 关闭
测试了一下,找到原因了
vim /etc/mongod.conf
如果加入配置:
security: javascriptEnabled: false
就会报错:
2018/11/15 09:56:50 /root/go/src/github.com/fecshopsoft/fec-go/shell/mapReduct.go:60: ########### 2018/11/15 09:56:50 /root/go/src/github.com/fecshopsoft/fec-go/shell/mapReduct.go:61: 1 2018/11/15 09:56:50 /root/go/src/github.com/fecshopsoft/fec-go/shell/mapReduct.go:85: 2018-11-15 2018/11/15 09:56:50 /root/go/src/github.com/fecshopsoft/fec-go/shell/mapReduct.go:86: mapReduceByDate ... 2018/11/15 09:56:50 /root/go/src/github.com/fecshopsoft/fec-go/shell/mapReduct.go:119: websiteId: 2018/11/15 09:56:50 /root/go/src/github.com/fecshopsoft/fec-go/shell/mapReduct.go:120: 9b17f5b4-b96f-46fd-abe6-a579837ccdd9 2018/11/15 09:56:50 /root/go/src/github.com/fecshopsoft/fec-go/shell/mapReduct.go:121: ########### 2018/11/15 09:56:50 /root/go/src/github.com/fecshopsoft/fec-go/shell/mapReduct.go:122: OutWholeBrowserCollName 2018/11/15 09:56:50 /root/go/src/github.com/fecshopsoft/fec-go/shell/mapReduct.go:89: cannot run map reduce without the js engine
将这个值设置为true即可
true
security: javascriptEnabled: true