[JAVA-3353] Document and BasicDBObject toJson methods move the _id field to the first key Created: 11/Jul/19 Updated: 28/Oct/23 Resolved: 24/Jul/19 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | JSON |
| Affects Version/s: | None |
| Fix Version/s: | 3.11.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jeffrey Yemin | Assignee: | John Stewart (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Description |
|
They both do this by calling EncoderContext.isEncodingCollectibleDocument(true). BsonDocument#toJson, inconsistently, does not do any re-ordering. I think the current behavior is wrong, as there are situations where this reordering is incorrect, e.g. for MongoDB index specifications. |
| Comments |
| Comment by Githook User [ 24/Jul/19 ] |
|
Author: {'name': 'John Stewart', 'username': 'jstewart-mongo', 'email': 'john.stewart@mongodb.com'}Message: |
| Comment by Githook User [ 24/Jul/19 ] |
|
Author: {'name': 'John Stewart', 'username': 'jstewart-mongo', 'email': 'john.stewart@mongodb.com'}Message: Avoid reordering of _id field in Document and BasicDBObject
|