[JAVA-1193] Java API only allows WriteResult.getN(), doesn't return nMatched, nUpserted, and nModified Created: 29/Apr/14 Updated: 30/Apr/14 Resolved: 30/Apr/14 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Write Operations |
| Affects Version/s: | 2.12.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Hendy Irawan | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
When updating via Mongo Shell (MongoDB 2.6.0) we get 3 'n' numbers :
However only `WriteResult.getN()` is provided by the Java API. From the mongo-java-driver 2.12.1 implementation :
is it correct? Since there seems to be no n field in the WriteResult object when observed via Mongo shell. |
| Comments |
| Comment by Jeffrey Yemin [ 30/Apr/14 ] |
|
You can access the new fields for new by using bulk write operations. See DBCollection.initializeOrderedBulkWriteOperation(). It returns a BulkWriteResult with all the new fields. |
| Comment by Hendy Irawan [ 30/Apr/14 ] |
|
jeff.yemin Thanks for explanation. In the meantime we'll be waiting for new WriteResult fields to be supported in Java API |
| Comment by Jeffrey Yemin [ 30/Apr/14 ] |
|
Yes, this is correct. The getN method will return what you're seeing in the shell for "nModified". There is some translation going on in the driver to handle the introduction of write commands in 2.6 while still maintaining compatibility with older servers. |
| Comment by Hendy Irawan [ 29/Apr/14 ] |
|
maybe related to |