private DBCollection getMapReduceOutputCollection(final MapReduceCommand command) { String requestedDatabaseName = command.getOutputDB(); DB database = requestedDatabaseName != null ? getDB().getSisterDB(requestedDatabaseName) : getDB(); return database.getCollection(command.getOutputTargetNonNull()); }
private DBCollection getMapReduceOutputCollection(final MapReduceCommand command) { String requestedDatabaseName = command.getOutputDB(); DB database = requestedDatabaseName != null ? getDB().getSisterDB(requestedDatabaseName) : getDB(); return database.getCollection(command.getOutputTargetNonNull()); }
if (authDB == null) { try { data = inputCollection.getDB().getSisterDB("admin").command(cmd); } catch (MongoException e) { // 2.0 servers throw exceptions rather than info in a CommandResult data = null; CommandResult stats = inputCollection.getStats(); if (stats.containsField("primary")) { DBCursor shards = inputCollection.getDB().getSisterDB("config") .getCollection("shards") .find(new BasicDBObject("_id", stats.getString("primary")));
try { data = inputCollection.getDB() .getSisterDB(inputURI.getDatabase()) .command(cmd, ReadPreference.primary()); } catch (final MongoException e) { // 2.0 servers throw exceptions rather than info in a CommandResult final CommandResult stats = inputCollection.getStats(); if (stats.containsField("primary")) { final DBCursor shards = inputCollection.getDB().getSisterDB("config") .getCollection("shards") .find(new BasicDBObject("_id", stats.getString("primary")));