DBCursor getters should not return copies for mutable objects

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 3.0.0
    • Affects Version/s: None
    • Component/s: Query Operations
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The 3.0.x branch implementation of DBCursor.getQuery and DBCursor.getKeysWanted return a copy of the internal property, whereas before they returned a reference to the internal copy. This break clients who do:

      DBCursor cursor = collection.find(new BasicDBObject());
      cursor.getQuery().put("x", 1);
      

      since because getQuery returns a copy, the put has no effect on the query that's actually performed.

      This should be reverted to the previous behavior.

              Assignee:
              Jeffrey Yemin
              Reporter:
              Jeffrey Yemin
              None
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: