I am trying to run an aggregation pipeline using node.js and mongodb native driver on a sharded mongodb cluster with 2 shards. The monogdb ver. is 2.6.1. The operation runs for about 50 minutes and throws the error 'errmsg" : "exception: getMore: cursor didn't exist on server, possible restart or timeout?"' On googling I came across this link . It looks like the issue is not resolved yet. BTW, the size of the collection is about 140 million documents.
Is there a fix/workaround for this issue?
Here is the pipeline that I am trying to run. I don't know at what stage it breaks. It runs for about 50 minutes and the error happens. Same is the case with any aggregation pipeline that I try to run.
db.collection01.aggregate([
{$match:{"state_cd":"CA"}},
{$group : {"_id": "$pat_id" , count : {$sum : 1}}}
],
{out: "distinct_patid_count", allowDiskUse: true }
)