/** * Gets the options that this client uses to connect to server. * * <p>Note: {@link MongoClientOptions} is immutable.</p> * * @return the options */ public MongoClientOptions getMongoClientOptions() { return super.getMongoClientOptions(); }
@Override public String toString() { return "Mongo{" + "options=" + getMongoClientOptions() + '}'; }
/** * <p>Returns the mongo options.</p> * * <p>Changes to {@code MongoOptions} that are done after connection are not reflected.</p> * * @return the mongo options * @deprecated Please use {@link MongoClient} class to connect to server and corresponding {@link * com.mongodb.MongoClient#getMongoClientOptions()} */ @SuppressWarnings("deprecation") @Deprecated public MongoOptions getMongoOptions() { return new MongoOptions(getMongoClientOptions()); }
/** * Gets a collection with a given name. * * @param name the name of the collection to return * @return the collection * @throws IllegalArgumentException if the name is invalid * @see MongoNamespace#checkCollectionNameValidity(String) */ public DBCollection getCollection(final String name) { DBCollection collection = collectionCache.get(name); if (collection != null) { return collection; } collection = new DBCollection(name, this, executor); if (mongo.getMongoClientOptions().getDbDecoderFactory() != DefaultDBDecoder.FACTORY) { collection.setDBDecoderFactory(mongo.getMongoClientOptions().getDbDecoderFactory()); } if (mongo.getMongoClientOptions().getDbEncoderFactory() != DefaultDBEncoder.FACTORY) { collection.setDBEncoderFactory(mongo.getMongoClientOptions().getDbEncoderFactory()); } DBCollection old = collectionCache.putIfAbsent(name, collection); return old != null ? old : collection; }
private boolean isCursorFinalizerEnabled() { return collection.getDB().getMongo().getMongoClientOptions().isCursorFinalizerEnabled(); }
/** * 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(); }
/** * Gets the options that this client uses to connect to server. * * <p>Note: {@link MongoClientOptions} is immutable.</p> * * @return the options */ public MongoClientOptions getMongoClientOptions() { return super.getMongoClientOptions(); }
@Override public String toString() { return "Mongo{" + "options=" + getMongoClientOptions() + '}'; }
/** * <p>Returns the mongo options.</p> * * <p>Changes to {@code MongoOptions} that are done after connection are not reflected.</p> * * @return the mongo options * @deprecated Please use {@link MongoClient} class to connect to server and corresponding {@link * com.mongodb.MongoClient#getMongoClientOptions()} */ @SuppressWarnings("deprecation") @Deprecated public MongoOptions getMongoOptions() { return new MongoOptions(getMongoClientOptions()); }
/** * Gets a collection with a given name. * * @param name the name of the collection to return * @return the collection * @throws IllegalArgumentException if the name is invalid * @see MongoNamespace#checkCollectionNameValidity(String) */ public DBCollection getCollection(final String name) { DBCollection collection = collectionCache.get(name); if (collection != null) { return collection; } collection = new DBCollection(name, this, executor); if (mongo.getMongoClientOptions().getDbDecoderFactory() != DefaultDBDecoder.FACTORY) { collection.setDBDecoderFactory(mongo.getMongoClientOptions().getDbDecoderFactory()); } if (mongo.getMongoClientOptions().getDbEncoderFactory() != DefaultDBEncoder.FACTORY) { collection.setDBEncoderFactory(mongo.getMongoClientOptions().getDbEncoderFactory()); } DBCollection old = collectionCache.putIfAbsent(name, collection); return old != null ? old : collection; }
private boolean isCursorFinalizerEnabled() { return collection.getDB().getMongo().getMongoClientOptions().isCursorFinalizerEnabled(); }
/** * 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(); }