Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3353

Document and BasicDBObject toJson methods move the _id field to the first key

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.11.0
    • Component/s: JSON
    • Labels:
      None

      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.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: