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

    XMLWordPrintable

    Details

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

      Description

      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)

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: