com.mongodb.Mongo.getMongoClientOptions()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(208)

本文整理了Java中com.mongodb.Mongo.getMongoClientOptions()方法的一些代码示例,展示了Mongo.getMongoClientOptions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mongo.getMongoClientOptions()方法的具体详情如下:
包路径:com.mongodb.Mongo
类名称:Mongo
方法名:getMongoClientOptions

Mongo.getMongoClientOptions介绍

暂无

代码示例

代码示例来源:origin: org.mongodb/mongo-java-driver

/**
 * 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();
}

代码示例来源:origin: org.mongodb/mongo-java-driver

@Override
public String toString() {
  return "Mongo{"
      + "options=" + getMongoClientOptions()
      + '}';
}

代码示例来源:origin: org.mongodb/mongo-java-driver

/**
 * <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());
}

代码示例来源:origin: org.mongodb/mongo-java-driver

/**
 * 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;
}

代码示例来源:origin: org.mongodb/mongo-java-driver

private boolean isCursorFinalizerEnabled() {
  return collection.getDB().getMongo().getMongoClientOptions().isCursorFinalizerEnabled();
}

代码示例来源:origin: org.mongodb/mongo-java-driver

/**
 * 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();
}

代码示例来源:origin: org.mongodb/mongodb-driver

/**
 * 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();
}

代码示例来源:origin: org.mongodb/mongodb-driver

@Override
public String toString() {
  return "Mongo{"
      + "options=" + getMongoClientOptions()
      + '}';
}

代码示例来源:origin: org.mongodb/mongodb-driver

/**
 * <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());
}

代码示例来源:origin: org.mongodb/mongodb-driver

/**
 * 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;
}

代码示例来源:origin: org.mongodb/mongodb-driver

private boolean isCursorFinalizerEnabled() {
  return collection.getDB().getMongo().getMongoClientOptions().isCursorFinalizerEnabled();
}

代码示例来源:origin: org.mongodb/mongodb-driver

/**
 * 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();
}

相关文章