protected void putDBRef ( final String name , final DBRef ref ) { BasicDBObject dbRefDocument = new BasicDBObject ( "$ref" , ref . getCollectionName ( ) ) . append ( "$id" , ref . getId ( ) ) ; if ( ref . getDatabaseName ( ) != null ) { dbRefDocument . put ( "$db" , ref . getDatabaseName ( ) ) ; } putObject ( name , dbRefDocument ) ; }
Deals with encoding database references .