com.mongodb.MongoClientSettings.Builder Java Examples
The following examples show how to use
com.mongodb.MongoClientSettings.Builder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestBase.java From morphia with Apache License 2.0 | 6 votes |
protected TestBase() { Builder builder = MongoClientSettings.builder(); try { builder.uuidRepresentation(mapperOptions.getUuidRepresentation()); } catch(Exception ignored) { // not a 4.0 driver } MongoClientSettings clientSettings = builder .applyConnectionString(new ConnectionString(getMongoURI())) .build(); this.mongoClient = MongoClients.create(clientSettings); this.database = getMongoClient().getDatabase(TEST_DB_NAME); this.ds = Morphia.createDatastore(getMongoClient(), database.getName()); ds.setQueryFactory(new DefaultQueryFactory()); }
Example #2
Source File: MongoDriverAgentIntercept.java From java-specialagent with Apache License 2.0 | 4 votes |
public static void exit(final Object returned) { if (!AgentRuleUtil.callerEquals(4, "com.mongodb.async.client.MongoClientSettings.createFromClientSettings")) ((Builder)returned).addCommandListener(new TracingCommandListener.Builder(GlobalTracer.get()).build()); }