本文整理汇总了Java中com.mongodb.reactivestreams.client.MongoClients类的典型用法代码示例。如果您正苦于以下问题:Java MongoClients类的具体用法?Java MongoClients怎么用?Java MongoClients使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MongoClients类属于com.mongodb.reactivestreams.client包,在下文中一共展示了MongoClients类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMongoClient
import com.mongodb.reactivestreams.client.MongoClients; //导入依赖的package包/类
private List<MongoClientWrapper> getMongoClient(List<ConnectionString> shardSet) {
mongoClients = new ArrayList<>();
try {
for (ConnectionString address : shardSet) {
com.mongodb.reactivestreams.client.MongoClient client = MongoClients.create(address);
mongoClients.add(new MongoClientWrapper(address.getConnectionString(), client));
Thread.sleep(100); // allow the client to establish prior to being
}
} catch (InterruptedException e) {
e.printStackTrace();
}
return mongoClients;
}
示例2: mongoClient
import com.mongodb.reactivestreams.client.MongoClients; //导入依赖的package包/类
@Bean
MongoClient mongoClient() {
return MongoClients.create();
}
示例3: mongoClient
import com.mongodb.reactivestreams.client.MongoClients; //导入依赖的package包/类
@Override
public MongoClient mongoClient() {
return MongoClients.create();
}
示例4: getMongoClient
import com.mongodb.reactivestreams.client.MongoClients; //导入依赖的package包/类
public static synchronized MongoClient getMongoClient() {
if (mongoClient == null) {
mongoClient = MongoClients.create(getConnectionString());
Runtime.getRuntime().addShutdownHook(new ShutdownHook());
}
return mongoClient;
}
示例5: mongoClient
import com.mongodb.reactivestreams.client.MongoClients; //导入依赖的package包/类
@Override
public MongoClient mongoClient() {
return MongoClients.create(String.format("mongodb://%s:%d", mongoProperties.getHost(), mongoProperties.getPort()));
}
示例6: mongoClient
import com.mongodb.reactivestreams.client.MongoClients; //导入依赖的package包/类
@Override
public MongoClient mongoClient() {
return MongoClients.create();
}
示例7: reactiveMongoClient
import com.mongodb.reactivestreams.client.MongoClients; //导入依赖的package包/类
@Override
public MongoClient reactiveMongoClient() {
return MongoClients.create(mongoUri);
}
示例8: mongoClient
import com.mongodb.reactivestreams.client.MongoClients; //导入依赖的package包/类
public MongoClient mongoClient() {
return MongoClients.create(String.format("mongodb://localhost:%d", mongoProperties.getPort()));
}
示例9: mongoClient
import com.mongodb.reactivestreams.client.MongoClients; //导入依赖的package包/类
@Override
@Bean
@DependsOn("embeddedMongoServer")
public MongoClient mongoClient() {
return MongoClients.create(String.format("mongodb://localhost:%d", mongoProperties.getPort()));
}
示例10: reactiveMongoClient
import com.mongodb.reactivestreams.client.MongoClients; //导入依赖的package包/类
@Override
public MongoClient reactiveMongoClient() {
return MongoClients.create("mongodb://localhost/"+getDatabaseName());
}
示例11: mongoClient
import com.mongodb.reactivestreams.client.MongoClients; //导入依赖的package包/类
@Override
public MongoClient mongoClient() {
return MongoClients.create(url);
}
示例12: mongoClient
import com.mongodb.reactivestreams.client.MongoClients; //导入依赖的package包/类
@Override
public MongoClient mongoClient() {
// this assumes your MongoDB is running on the default port, i.e. 27017
return MongoClients.create();
}
示例13: reactiveMongoClient
import com.mongodb.reactivestreams.client.MongoClients; //导入依赖的package包/类
@Override
public MongoClient reactiveMongoClient() {
return MongoClients.create(url);
}