[JAVA-1608] Unable to query data after writing to DB in java Created: 05/Jan/15 Updated: 11/Sep/19 Resolved: 05/Jan/15 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Carlos | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Eclipse (Windows) |
||
| Description |
|
I am using java to write to a MongoDB the following way: document.put("someKey", someValue); It writes to the DB fine, however I am UNABLE TO QUERY out the results. db.myCollection.find().forEach(printjson); The command above will show ALL the results for that particular table in JSON format (As its expected), however if run the following command: db.myCollection.find( {someKey : "someValue"}, {_id: 0, someKey : 1}); I get no results, or at least none written from my Java code, if I write entries any other way, they do query out normally. I am wondering if this is a common problem, and if there's a work around for it. Note: I also noticed that the entries written from my Java code are indented a little further than the entries NOT written from the Java code. |
| Comments |
| Comment by Jeffrey Yemin [ 05/Jan/15 ] |
|
It's hard to tell what you are doing wrong without more details, but the place to collection that is on the mongodb-user Google group or Stack Overflow. Can you post your question there, and include some more specific information including the actual query that you are running, and a sample document from the collection that you think should be included in the results? Regards, |