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

BsonDocument.clone should return a mutable deep copy, or we need a different mechanism of achieving that

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 4.10.0
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • Fully Compatible
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Currently we have at least two places (that I know of) where we rely on BsonDocument.clone returning not only a deep copy, but mutable deep copy:

      1. AbstractConstructibleBson.newMerged
      2. The new method ClientEncryption.createEncryptedCollection introduced in https://github.com/mongodb/mongo-java-driver/pull/1079.

      ross@mongodb.com pointed out that RawBsonDocument breaks the "mutable" part and can come from users.

            Assignee:
            valentin.kovalenko@mongodb.com Valentin Kavalenka
            Reporter:
            valentin.kovalenko@mongodb.com Valentin Kavalenka
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: