Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-807

Driver should not allow the EXHAUST flag to be set on DBCursor.setOptions

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.11.1
    • Component/s: API
    • None

      It is not allowed on DBCursor.addOption, but it is on DBCursor.setOption. Here's what happens if you use it:

      
      

      import com.mongodb.*
      import java.net.UnknownHostException;

      public class ExhaustTest {
      public static void main(String[] args) throws UnknownHostException {
      MongoClient client = new MongoClient();
      DBCollection coll = client.getDB("test").getCollection("CS6843");
      for (int i = 0; i < 100000; i++)

      { coll.insert(new BasicDBObject(), WriteConcern.UNACKNOWLEDGED); }

      DBCursor cursor = coll.find();
      cursor.setOptions(Bytes.QUERYOPTION_EXHAUST);
      cursor.toArray(10000);
      }
      }

      Exception in thread "main" com.mongodb.MongoException: ids don't match
      	at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:246)
      	at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:216)
      	at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:184)
      	at com.mongodb.DBApiLayer$Result._advance(DBApiLayer.java:430)
      	at com.mongodb.DBApiLayer$Result.hasNext(DBApiLayer.java:399)
      	at com.mongodb.DBCursor._hasNext(DBCursor.java:464)
      	at com.mongodb.DBCursor._fill(DBCursor.java:518)
      	at com.mongodb.DBCursor.toArray(DBCursor.java:553)
      

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: