欢迎
我在机器上用MONGO3.0进行聚合
mongo ${DB_HOST_PORT}/${DATE} ${BASE_PATH}/temp/script.js > "${BASE_PATH}/temp/listofcampaigns.csv" --quiet
var cursor=db.getCollection('combined_data').aggregate([{"$match":{"src":"sender","customer":"test","name":"ntf_NotificationSent","time":{"$gte":"2016-11-23T00:00:00.000Z","$lt":"2016-11-23T01:00:00.000Z"}}},
{"$group":{"_id":{"campaign":"$spec:crm:cmp:campaign:id"},"count":{"$sum":1}}},{"$sort":{"count":-1}}]);
if (cursor && cursor.hasNext()) { print('campaign, count');
while ( cursor.hasNext() ) { var item = cursor.next(); print('' + item._id.campaign + ', ' + item.count); }}它正常工作,但是,在安装了TokuMX的机器上运行这个程序后,我有一个错误:
at 11月23日14:13:06.443 TypeError: Object对象没有方法'hasNext‘at(.)/temp/script.js加载失败:(.)/temp/script.js
有人能帮我吗?或者有人有工作示例,如何使用TokuMX在计算机上运行这种聚合?
结果文件应该如下所示:
campaign, count
xyz, 5
yxz, 6发布于 2016-11-24 09:33:23
它依赖于2.4版和2.6版之间的内部API更改。最好的解决方案用于来自TokuMX的客户端,因为它与MongoDB 2.4引擎兼容版本。
在这种情况下,结果不是一个对象。这是一个数组。使用下面的代码片段在代码中调试它:
// show whole data
printjson(result);
// show keys only
printjson(Object.keys(result));https://stackoverflow.com/questions/40765636
复制相似问题