/** * @param databaseName the name of the database to retrieve * @return a {@code MongoDatabase} representing the specified database * @throws IllegalArgumentException if databaseName is invalid * @see MongoNamespace#checkDatabaseNameValidity(String) */ public MongoDatabase getDatabase(final String databaseName) { MongoClientOptions clientOptions = getMongoClientOptions(); return new MongoDatabaseImpl(databaseName, clientOptions.getCodecRegistry(), clientOptions.getReadPreference(), clientOptions.getWriteConcern(), clientOptions.getRetryWrites(), clientOptions.getReadConcern(), createOperationExecutor()); }
/** * Constructs new {@code DBCollection} instance. This operation not reflected on the server. * @param name the name of the collection * @param database the database to which this collections belongs to */ DBCollection(final String name, final DB database, final OperationExecutor executor) { checkCollectionNameValidity(name); this.name = name; this.database = database; this.executor = executor; this.optionHolder = new Bytes.OptionHolder(database.getOptionHolder()); this.objectFactory = new DBCollectionObjectFactory(); this.objectCodec = new CompoundDBObjectCodec(getDefaultDBObjectCodec()); this.retryWrites = database.getMongo().getMongoClientOptions().getRetryWrites(); }
readPreference = options.getReadPreference(); writeConcern = options.getWriteConcern(); retryWrites = options.getRetryWrites(); readConcern = options.getReadConcern(); codecRegistry = options.getCodecRegistry();
/** * @param databaseName the name of the database to retrieve * @return a {@code MongoDatabase} representing the specified database * @throws IllegalArgumentException if databaseName is invalid * @see MongoNamespace#checkDatabaseNameValidity(String) */ public MongoDatabase getDatabase(final String databaseName) { MongoClientOptions clientOptions = getMongoClientOptions(); return new MongoDatabaseImpl(databaseName, clientOptions.getCodecRegistry(), clientOptions.getReadPreference(), clientOptions.getWriteConcern(), clientOptions.getRetryWrites(), clientOptions.getReadConcern(), createOperationExecutor()); }
/** * Constructs new {@code DBCollection} instance. This operation not reflected on the server. * @param name the name of the collection * @param database the database to which this collections belongs to */ DBCollection(final String name, final DB database, final OperationExecutor executor) { checkCollectionNameValidity(name); this.name = name; this.database = database; this.executor = executor; this.optionHolder = new Bytes.OptionHolder(database.getOptionHolder()); this.objectFactory = new DBCollectionObjectFactory(); this.objectCodec = new CompoundDBObjectCodec(getDefaultDBObjectCodec()); this.retryWrites = database.getMongo().getMongoClientOptions().getRetryWrites(); }
readPreference = options.getReadPreference(); writeConcern = options.getWriteConcern(); retryWrites = options.getRetryWrites(); readConcern = options.getReadConcern(); codecRegistry = options.getCodecRegistry();