Reputation: 14865
HI i'm working with the Java-Api of mongo-db.
I have to cast verry often like this
BasicDBList points = ((BasicDBList) ((BasicDBObject) currentObject.get("poly")).get("coordinates"));
which is not fun. Am i missing something or it is just the way to do it?
i think BasicDBObject should have functions like
BasicDBObject getBasicDBObject(String key)
BasicDBList getBasicDBList(String key)
Upvotes: 1
Views: 214
Reputation:
Unfortunately, the current java driver is not perfect and it is difficult to avoid casting as you mentioned. However, java driver team is working on the next version and as far as I understand it will be completely rewritten.
In one of the mongodb meetup I heard that the new version will make use of asynchronous API, similar to the node driver. I guess we need to sit tight and wait for the next major release.
Alternatives, are (from Mongo Java drivers & mappers performances):
Upvotes: 1