Пример #1
0
  public <T> T eachNode(ReadChildrenEach<T> readJob) {
    DBCursor cursor = null;
    try {
      cursor = collection.find(filters(), fields(), skip, offset).sort(orderBy).limit(offset);
      if (this.hint != null) cursor.hint(hint);
      else if (this.hintIndexName != null) cursor.hint(hintIndexName);

      session.attribute(Explain.class.getCanonicalName(), Explain.create(cursor.explain()));
      ReadChildrenIterator citer = ReadChildrenIterator.create(session, cursor);
      T result = readJob.handle(citer);
      return result;
    } finally {
      IOUtil.close(cursor);
    }
  }