本文整理了Java中org.mongodb.morphia.Datastore.getMongo()
方法的一些代码示例,展示了Datastore.getMongo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Datastore.getMongo()
方法的具体详情如下:
包路径:org.mongodb.morphia.Datastore
类名称:Datastore
方法名:getMongo
[英]Get the underlying MongoClient that allows connection to the MongoDB instance being used.
[中]获取允许连接到正在使用的MongoDB实例的基础MongoClient。
代码示例来源:origin: acmeair/acmeair
@SuppressWarnings("deprecation")
public String getDriverVersion(){
return datastore.getMongo().getVersion();
}
代码示例来源:origin: fabianenardon/docker-java-issues-demo
/**
*
* @param args
*
*/
public static void main(String[] args) throws Exception {
if (args == null || args.length == 0) {
System.err.println("MongoDB server not informed.");
System.exit(1);
}
String mongoHost = args[0];
MongoClient mongo = new MongoClient(mongoHost);
Morphia morphia = new Morphia();
Datastore ds = morphia.createDatastore(mongo, App.DATABASE);
try {
Document document = new Document();
document.append("text", "Hello World");
ds.getMongo()
.getDatabase(App.DATABASE)
.getCollection(App.COLLECTION).insertOne(document);
} finally {
ds.getMongo().close();
}
}
代码示例来源:origin: acmeair/acmeair
Morphia morphia = new Morphia();
result = morphia.createDatastore( mongo ,mongoURI.getDatabase());
System.out.println("create mongo datastore with options:"+result.getMongo().getMongoClientOptions());
}catch (Exception e)
代码示例来源:origin: acmeair/acmeair
logger.info("created mongo datastore with options:"+datastore.getMongo().getMongoClientOptions());
内容来源于网络,如有侵权,请联系作者删除!