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

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

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

GridFS.injectGridFSInstance介绍

暂无

代码示例

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

/**
 * Finds one file matching the given query.
 *
 * @param query filter to apply
 * @return a gridfs file
 * @throws com.mongodb.MongoException if the operation fails
 */
public GridFSDBFile findOne(final DBObject query) {
  return injectGridFSInstance(filesCollection.findOne(query));
}

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

/**
 * Finds a list of files matching the given query.
 *
 * @param query the filter to apply
 * @param sort  the fields to sort with
 * @return list of gridfs files
 * @throws com.mongodb.MongoException if the operation fails
 */
public List<GridFSDBFile> find(final DBObject query, final DBObject sort) {
  List<GridFSDBFile> files = new ArrayList<GridFSDBFile>();
  DBCursor cursor = filesCollection.find(query);
  if (sort != null) {
    cursor.sort(sort);
  }
  try {
    while (cursor.hasNext()) {
      files.add(injectGridFSInstance(cursor.next()));
    }
  } finally {
    cursor.close();
  }
  return Collections.unmodifiableList(files);
}

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

/**
 * Finds one file matching the given query.
 *
 * @param query filter to apply
 * @return a gridfs file
 * @throws com.mongodb.MongoException if the operation fails
 */
public GridFSDBFile findOne(final DBObject query) {
  return injectGridFSInstance(filesCollection.findOne(query));
}

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

/**
 * Finds a list of files matching the given query.
 *
 * @param query the filter to apply
 * @param sort  the fields to sort with
 * @return list of gridfs files
 * @throws com.mongodb.MongoException if the operation fails
 */
public List<GridFSDBFile> find(final DBObject query, final DBObject sort) {
  List<GridFSDBFile> files = new ArrayList<GridFSDBFile>();
  DBCursor cursor = filesCollection.find(query);
  if (sort != null) {
    cursor.sort(sort);
  }
  try {
    while (cursor.hasNext()) {
      files.add(injectGridFSInstance(cursor.next()));
    }
  } finally {
    cursor.close();
  }
  return Collections.unmodifiableList(files);
}

相关文章