Details
-
Improvement
-
Resolution: Done
-
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