public CommandResult command ( final DBObject command , final ReadPreference readPreference , @ Nullable final DBEncoder encoder ) { try { return executeCommand ( wrap ( command , encoder ) , getCommandReadPreference ( command , readPreference ) ) ; } catch ( MongoCommandException ex ) { return new CommandResult ( ex . getResponse ( ) , ex . getServerAddress ( ) ) ; } }
Executes a database command with the selected readPreference and encodes the command using the given encoder .