[JAVA-617] Don't understand the difference between these queries: Created: 06/Aug/12  Updated: 11/Sep/19  Resolved: 06/Aug/12

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

Type: Task Priority: Major - P3
Reporter: Bruce Rex Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Win7



 Description   

given this SQL query:
query = "select SESSION_ID from SESSIONS where PLAYER_ID='" + playerId + "' and END_DTS is null";

why does this work:
BasicDBObject condQry = new BasicDBObject("player_id", playerId).append("session_end_dts", 0L);
BasicDBObject fldsQry = new BasicDBObject("session_id", 1);

cur = coll.find(condQry, fldsQry);

but this does not:
query.put("session_id", new BasicDBObject("player_id", playerId)).append("session_end_dts", 0L).append("session_id", 1));
cur = coll.find(query);

??



 Comments   
Comment by Bruce Rex [ 06/Aug/12 ]

Thanks.

Comment by Jeffrey Yemin [ 06/Aug/12 ]

That's just how the API works. The query portion and the fields portion have to be two different documents.

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