com.mongodb.gridfs.GridFS.getFileList()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中com.mongodb.gridfs.GridFS.getFileList()方法的一些代码示例,展示了GridFS.getFileList()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridFS.getFileList()方法的具体详情如下:
包路径:com.mongodb.gridfs.GridFS
类名称:GridFS
方法名:getFileList

GridFS.getFileList介绍

[英]Gets the list of files stored in this gridfs, sorted by filename.
[中]获取存储在此gridfs中的文件列表,按文件名排序。

代码示例

代码示例来源:origin: org.mongodb/mongo-java-driver

DBCursor fileListCursor = fs.getFileList();
try {
  while (fileListCursor.hasNext()) {

代码示例来源:origin: richardwilly98/elasticsearch-river-mongodb

cursor = grid.getFileList();
while (cursor.hasNext()) {
  DBObject object = cursor.next();

代码示例来源:origin: Findwise/Hydra

@Override
public List<DatabaseFile> getFiles() {
  ArrayList<DatabaseFile> list = new ArrayList<DatabaseFile>();
  
  DBCursor cursor = pipelinefs.getFileList();
  while(cursor.hasNext()) {
    DBObject dbo = cursor.next();
    list.add(getFile(dbo));
  }
  
  return list;
}

代码示例来源:origin: com.commercehub.jclouds/jclouds-gridfs-blobstore

private static GridFSDBFile getMostRecentlyUploadedFile(GridFS gridFS, String filename) {
  DBObject queryByFilename = new BasicDBObject("filename", filename);
  DBObject sortByUploadDateDescending = new BasicDBObject("uploadDate", -1);
  DBCursor dbCursor = gridFS.getFileList(queryByFilename, sortByUploadDateDescending);
  return dbCursor.hasNext() ? getGridFSDBFileForDBObject(gridFS, dbCursor.next()) : null;
}

代码示例来源:origin: org.apache.beam/beam-sdks-java-io-mongodb

private DBCursor createCursor(GridFS gridfs) {
 if (spec.filter() != null) {
  DBObject query = (DBObject) JSON.parse(spec.filter());
  return gridfs.getFileList(query).sort(null);
 }
 return gridfs.getFileList().sort(null);
}

代码示例来源:origin: lmco/streamflow

@Override
public List<FileContent> findAll() {
  List<FileContent> files = new ArrayList<FileContent>();
  DBCursor cursor = gridFs.getFileList();
  while (cursor.hasNext()) {
    DBObject dbObject = cursor.next();
    FileContent fileContent = new FileContent();
    fileContent.setId((String) dbObject.get("_id"));
  }
  return files;
}

代码示例来源:origin: org.apache.camel/camel-mongodb-gridfs

DBCursor cursor;
if (filename == null) {
  cursor = endpoint.getGridFs().getFileList();
} else {
  cursor = endpoint.getGridFs().getFileList(new BasicDBObject("filename", filename));
DBCursor cursor;
if (filename == null) {
  cursor = endpoint.getGridFs().getFileList();
} else {
  cursor = endpoint.getGridFs().getFileList(new BasicDBObject("filename", filename));

代码示例来源:origin: org.mongodb/mongodb-driver

DBCursor fileListCursor = fs.getFileList();
try {
  while (fileListCursor.hasNext()) {

代码示例来源:origin: Findwise/Hydra

@Override
public boolean deleteDocumentFile(DatabaseDocument<MongoType> d, String fileName) {
  MongoDocument md = (MongoDocument) d;
  DBObject query = QueryBuilder.start(DOCUMENT_KEY).is(md.getID().getID()).and(FILENAME_KEY).is(fileName).get();
  if (documentfs.getFileList(query).size() != 1) {
    return false;
  }
  
  documentfs.remove(query);
  return true;
  
}

相关文章