本文整理了Java中com.mongodb.gridfs.GridFS.getBucketName()
方法的一些代码示例,展示了GridFS.getBucketName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridFS.getBucketName()
方法的具体详情如下:
包路径:com.mongodb.gridfs.GridFS
类名称:GridFS
方法名:getBucketName
[英]Gets the bucket name used in the collection's namespace. Default value is 'fs'.
[中]获取集合命名空间中使用的存储桶名称。默认值为“fs”。
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!