/** * Constructs a new instance of the {@code DB}. * * @param mongo the mongo instance * @param name the database name - must not be empty and cannot contain spaces * @deprecated Prefer {@link MongoClient#getDB(String)} */ @Deprecated public DB(final Mongo mongo, final String name) { this(mongo, name, mongo.createOperationExecutor()); }
db = new DB(this, dbName, createOperationExecutor()); DB temp = dbCache.putIfAbsent(dbName, db); if (temp != null) {
/** * Unlocks the database, allowing the write operations to go through. This command may be asynchronous on the server, which means there * may be a small delay before the database becomes writable. * * @return {@code DBObject} in the following form {@code {"ok": 1,"info": "unlock completed"}} * @throws MongoException if there's a failure * @mongodb.driver.manual reference/command/fsync/ fsync command */ @Deprecated public DBObject unlock() { return DBObjects.toDBObject(createOperationExecutor().execute(new FsyncUnlockOperation(), readPreference, readConcern)); }
/** * Gets a list of the names of all databases on the connected server. * * @return list of database names * @throws MongoException if the operation fails * @deprecated Replaced with {@link com.mongodb.MongoClient#listDatabaseNames()} */ @Deprecated public List<String> getDatabaseNames() { return new MongoIterableImpl<DBObject>(null, createOperationExecutor(), ReadConcern.DEFAULT, primary()) { @Override public ReadOperation<BatchCursor<DBObject>> asReadOperation() { return new ListDatabasesOperation<DBObject>(MongoClient.getCommandCodec()); } }.map(new Function<DBObject, String>() { @Override public String apply(final DBObject result) { return (String) result.get("name"); } }).into(new ArrayList<String>()); }
/** * Returns true if the database is locked (read-only), false otherwise. * * @return result of the command execution * @throws MongoException if the operation fails * @mongodb.driver.manual reference/command/fsync/ fsync command */ @Deprecated public boolean isLocked() { return createOperationExecutor().execute(new CurrentOpOperation(), ReadPreference.primary(), readConcern) .getBoolean("fsyncLock", BsonBoolean.FALSE).getValue(); }
/** * Constructs a new instance of the {@code DB}. * * @param mongo the mongo instance * @param name the database name - must not be empty and cannot contain spaces * @deprecated Prefer {@link MongoClient#getDB(String)} */ @Deprecated public DB(final Mongo mongo, final String name) { this(mongo, name, mongo.createOperationExecutor()); }
db = new DB(this, dbName, createOperationExecutor()); DB temp = dbCache.putIfAbsent(dbName, db); if (temp != null) {
/** * Unlocks the database, allowing the write operations to go through. This command may be asynchronous on the server, which means there * may be a small delay before the database becomes writable. * * @return {@code DBObject} in the following form {@code {"ok": 1,"info": "unlock completed"}} * @throws MongoException if there's a failure * @mongodb.driver.manual reference/command/fsync/ fsync command */ @Deprecated public DBObject unlock() { return DBObjects.toDBObject(createOperationExecutor().execute(new FsyncUnlockOperation(), readPreference, readConcern)); }
/** * Gets a list of the names of all databases on the connected server. * * @return list of database names * @throws MongoException if the operation fails * @deprecated Replaced with {@link com.mongodb.MongoClient#listDatabaseNames()} */ @Deprecated public List<String> getDatabaseNames() { return new MongoIterableImpl<DBObject>(null, createOperationExecutor(), ReadConcern.DEFAULT, primary()) { @Override public ReadOperation<BatchCursor<DBObject>> asReadOperation() { return new ListDatabasesOperation<DBObject>(MongoClient.getCommandCodec()); } }.map(new Function<DBObject, String>() { @Override public String apply(final DBObject result) { return (String) result.get("name"); } }).into(new ArrayList<String>()); }
/** * Returns true if the database is locked (read-only), false otherwise. * * @return result of the command execution * @throws MongoException if the operation fails * @mongodb.driver.manual reference/command/fsync/ fsync command */ @Deprecated public boolean isLocked() { return createOperationExecutor().execute(new CurrentOpOperation(), ReadPreference.primary(), readConcern) .getBoolean("fsyncLock", BsonBoolean.FALSE).getValue(); }