0

Welcome

I was doing aggregation on machine with Mongo 3.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);  }}

And it was working without problems, but, after I run this on machine with TokuMX installed, I have ony error:

Wed Nov 23 14:13:06.443 TypeError: Object [object Object] has no method 'hasNext' at (...)/temp/script.js failed to load: (...)/temp/script.js

Can someone help me with this ? Or maybe someone have working example how to run this kind of aggregation on machine with TokuMX ?

Result file should look like this:

campaign, count
xyz, 5
yxz, 6

1 Answers1

0

It depend on internal API changes between version 2.4 and 2.6. Best solution is used for it client from TokuMX because it is in version compatible with MongoDB 2.4 Engine.

In this case result isn't an object. It is an array. Use below snippets to debug it in code:

// show whole data
printjson(result);
// show keys only
printjson(Object.keys(result));