Currently, if you call BasicDBObject.parse on a json string like the following:
{ myDbRef: { $ref: "collection", $id: { $oid: "59ce7963a43f254534602da9" }, $db: "myDB" }
The Java Driver will return an object that contains the "$ref" and "$id" as supplied, but drops the "$db". The cause for this seems to be these lines: https://github.com/mongodb/mongo-java-driver/blob/master/driver/src/main/com/mongodb/DBObjectCodec.java#L359-L363 which discard the "$db" value and use the constructor for DBRef that doesn't include $db.
The verifyForDBRef function should be modified to use both constructors based on whether or not "$db" is available