title: Error in db.eval() in MongoDB
body: <p>I am trying to run a <em>map-reduce</em> script using <code>db.eval()</code> method. </p>
  
  <pre><code>    MongoClient mongo = new MongoClient("localhost", 27017);
      DB mongodb = (DB) mongo.getDB("testDB");
  
      String script = "db.collection.mapReduce("
              + "function() {emit(this.class, this.marks);},"
              + "function(key, values) { return {\"sum\":Array.sum(values)};},"
                 + "{ "
                     + " query : {_id:{$lt:50}},"
                     + "out:\"collectionMapReduce\""
                 + "}"
             + ")";
  
      Object result = mongodb.eval(script);
  </code></pre>
  
  <p>I got the following error : </p>
  
  <pre><code>Exception in thread "main" com.mongodb.MongoException$Network: Read operation to server localhost:27017 failed on database testDB
  at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:298)
  at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:269)
  at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:84)
  at com.mongodb.DB.command(DB.java:320)
  at com.mongodb.DB.command(DB.java:299)
  at com.mongodb.DB.command(DB.java:374)
  at com.mongodb.DB.command(DB.java:246)
  at com.mongodb.DB.doEval(DB.java:445)
  at com.mongodb.DB.eval(DB.java:463)
  at com.dev.TestMapReduce.main(TestMapReduce.java:25)
  
  Caused by: java.io.EOFException
  at org.bson.io.Bits.readFully(Bits.java:75)
  at org.bson.io.Bits.readFully(Bits.java:50)
  at org.bson.io.Bits.readFully(Bits.java:37)
  at com.mongodb.Response.&lt;init&gt;(Response.java:42)
  at com.mongodb.DBPort$1.execute(DBPort.java:164)
  at com.mongodb.DBPort$1.execute(DBPort.java:158)
  at com.mongodb.DBPort.doOperation(DBPort.java:187)
  at com.mongodb.DBPort.call(DBPort.java:158)
  at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:290)
  ... 9 more
  </code></pre>
  
  <p>I am not able to understand the reason for this error. How can I resolve this? </p>
  
  <blockquote>
    <p>Note: I am able to perform this job using <code>db.collection.mapReduce()</code>.
    But I am just trying to achieve this using <code>db.eval()</code></p>
  </blockquote>