}
});
}
private <ResponseType> ResponseType executeCommand(AbstractCommand<ResponseType> command, Connection connection) {
CommandResponse response = connection.execute(new CommandRequest(dbName, command.requestMap(AbstractDBCollection.this), queryCoders));
if (response == null) {
throw new NotFoundException("Value not returned for command: " + command);
}
Object result = response.get("ok");
if (!result.equals(1D) && !result.equals(Boolean.TRUE)) {
throw new MongoException("Command execution failed", response);
}
return command.parseResponse(response);
}