title: i/o timeout with mgo and mongodb
body: <p>I am running a map-reduce job from mgo. It runs on a collection with a little more than 3.5M records. For some reasons right now I can not port this to aggregation; may be later. So, map-reduce is the thing I am looking forward to. This job, when I run it from the original js files I have created to test the code and output, runs fine. I tried to put the map and reduce code inside two strings and then tried to call the mgo.MapReduce to do the map-reduce for me where I am writing the output in a different collection. And it gives me </p>
  
  <p>read tcp 127.0.0.1:27017: i/o timeout</p>
  
  <p>Though, as the job has been fired in back-ground it is still running. Now according to this thread here --- <a href="http://grokbase.com/t/gg/mgo-users/1396d9wyk3/i-o-timeout-in-statistics-generation-upsert" rel="noreferrer">http://grokbase.com/t/gg/mgo-users/1396d9wyk3/i-o-timeout-in-statistics-generation-upsert</a></p>
  
  <p>It is easy to solve by calling the session.SetSocketTimeout but I do not want to do this as the total number of documents on which this map-reduce will run will vary and thus, I believe, the time. So, I will never be able to solve the problem by that way I believe. </p>
  
  <p>What are the other ways that I might have?</p>
  
  <p>Please help me</p>