[JAVA-807] Driver should not allow the EXHAUST flag to be set on DBCursor.setOptions Created: 16/Apr/13  Updated: 12/Jul/13  Resolved: 12/Jul/13

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: 2.11.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to JAVA-808 Support the Exhaust flag on query Closed

 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)



 Comments   
Comment by Jeffrey Yemin [ 12/Jul/13 ]

Since we're going to add support for Exhaust in 3.0, let's just not bother with this one.

Comment by Jeffrey Yemin [ 19/Apr/13 ]

Linking to JAVA-808. We do intend to support it, but if we do another release before we add that support, it makes to add code to throw an exception early rather than the confusing "ids don't match" exception.

Also, pymongo does not yet support the exhaust flag either, though there is a ticket to add it that's in the queue for a future release.

Comment by Yuri Finkelstein [ 19/Apr/13 ]

Exhaust is a valuable option and removing it from Java driver is wrong. Instead, the driver needs to be fixed to support it. C++ and Python support it, why should Java be different?

Generated at Thu Feb 08 08:53:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.