本文整理了Java中com.mongodb.gridfs.GridFS.getDB()
方法的一些代码示例,展示了GridFS.getDB()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridFS.getDB()
方法的具体详情如下:
包路径:com.mongodb.gridfs.GridFS
类名称:GridFS
方法名:getDB
[英]Gets the database used.
[中]获取使用的数据库。
代码示例来源:origin: org.mongodb/mongo-java-driver
/**
* Verifies that the MD5 matches between the database and the local file. This should be called after transferring a file.
*
* @throws MongoException if there's a failure
* @deprecated there is no replacement for this method
*/
@Deprecated
public void validate() {
if (fs == null) {
throw new MongoException("no fs");
}
if (md5 == null) {
throw new MongoException("no md5 stored");
}
DBObject cmd = new BasicDBObject("filemd5", id);
cmd.put("root", fs.getBucketName());
DBObject res = fs.getDB().command(cmd);
if (res != null && res.containsField("md5")) {
String m = res.get("md5").toString();
if (m.equals(md5)) {
return;
}
throw new MongoException("md5 differ. mine [" + md5 + "] theirs [" + m + "]");
}
// no md5 from the server
throw new MongoException("no md5 returned from server: " + res);
}
代码示例来源:origin: org.mongodb/mongodb-driver
/**
* Verifies that the MD5 matches between the database and the local file. This should be called after transferring a file.
*
* @throws MongoException if there's a failure
* @deprecated there is no replacement for this method
*/
@Deprecated
public void validate() {
if (fs == null) {
throw new MongoException("no fs");
}
if (md5 == null) {
throw new MongoException("no md5 stored");
}
DBObject cmd = new BasicDBObject("filemd5", id);
cmd.put("root", fs.getBucketName());
DBObject res = fs.getDB().command(cmd);
if (res != null && res.containsField("md5")) {
String m = res.get("md5").toString();
if (m.equals(md5)) {
return;
}
throw new MongoException("md5 differ. mine [" + md5 + "] theirs [" + m + "]");
}
// no md5 from the server
throw new MongoException("no md5 returned from server: " + res);
}
代码示例来源:origin: suninformation/ymate-platform-v2
public MongoGridFSSession(IMongoDataSourceAdapter dataSourceAdapter, String bucketName) throws Exception {
this.__id = UUIDUtils.UUID();
this.__dataSourceHolder = dataSourceAdapter;
this.__bucketName = StringUtils.defaultIfBlank(bucketName, GridFS.DEFAULT_BUCKET);
//
__gridFS = new GridFS(new DB(dataSourceAdapter.getMongoClient(), dataSourceAdapter.getDataSourceCfgMeta().getDatabaseName()), __bucketName);
__dbCollection = __gridFS.getDB().getCollection(__bucketName.concat(".files"));
}
代码示例来源:origin: Kurento/kurento-java
public void execute() throws Exception {
startServer();
RepositoryItem repositoryItem = getRepository().createRepositoryItem();
Repository repo = getRepository();
if (repo instanceof MongoRepository) {
MongoRepository mrepo = (MongoRepository) repo;
mrepo.getGridFS().getDB().dropDatabase();
}
prepareToUploadVideo(repositoryItem);
prepareToDownloadVideo(repositoryItem);
stopServer();
}
内容来源于网络,如有侵权,请联系作者删除!