Example #1
0
  public ObjectListPresentation explain() {
    MongoCollection<Document> collection = getCollection();

    FindIterable findIterable =
        new FindIterable(
            new MongoNamespace(mongoDatabase.getName(), collectionName),
            collection.getCodecRegistry(), //
            collection.getReadPreference(),
            getExecutor(),
            findQuery,
            findOptions);

    BsonDocument res = findIterable.explainIterator(ExplainVerbosity.QUERY_PLANNER);
    return JsApiUtils.singletonIter(JsApiUtils.convertBsonToDocument(res));
  }
Example #2
0
  @JsIgnore
  @Override
  public MongoCursor<Document> iterator(int skip, int limit) {
    MongoCollection<Document> collection = getCollection();

    findOptions.skip(skip);
    findOptions.limit(limit);
    if (projection != null) {
      findOptions.projection(projection);
    }
    if (sort != null) {
      findOptions.sort(dbObjectFromMap(sort));
    }
    return new FindIterable(
            new MongoNamespace(mongoDatabase.getName(), collectionName),
            collection.getCodecRegistry(), //
            collection.getReadPreference(),
            getExecutor(),
            findQuery,
            findOptions)
        .iterator();
  }
Example #3
0
 @Override
 public ReadPreference getReadPreference() {
   return coll.getReadPreference();
 }