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

all method that take a DBObject, make a version that takes a map

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • None
    • None

    Description

      There are many places in the Mongo Java API that use the DBObject interface as parameter or return value. BasicDBObject is the most commonly used implementation of DBObject, which implements java.util.Map, but since none of the methods accept or return Map, we're forced to make intermediate BasicDBObject wrappers around objects that could otherwise be passed straight in. If these methods were updated to accept/return Maps, usage could be simpler and less onerous on user code.

      Below is a list of the spots in the API that could benefit (I think) from being updated:

      The DBObject interface could implement Map
      BasicDBObject - constructor could accept a Map
      DBCursor.toArray() - could return List<Map>
      DBCursor.curr(), explain(), next() could all return Map
      DBCollection - ensureIndex() and friends could accept Map
      DBCollection - find() & findOne() could accept Map
      DBCollection - getIndexInfo() could return List<Map>
      DBCollection - apply(), insert(), remove(), save(), update() could all accept Map

      Attachments

        Activity

          People

            kristina Kristina Chodorow (Inactive)
            liamstask Liam Staskawicz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: