Package com.mongodb

Examples of com.mongodb.DBCursor.limit()


                DBCursor cur = col.find(query, fields).skip(skip).batchSize(batchSize).addOption(options);
                if (sort != null) {
                    cur.sort(sort);
                }
                if (limit > 0) {
                    cur.limit(limit);
                }
                if (hint != null) {
                    cur.hint(hint);
                }
                if (explain) {
View Full Code Here


                        }
                        if (sort != null) {
                            cur.sort(sort);
                        }
                        if (limit > 0) {
                            cur.limit(limit);
                        }
                        while (cur.hasNext() && !stopped) {
                            ds.writeObject(cur.next());
                        }
                    } catch (Exception e) {
View Full Code Here

        cursor.setDecoderFactory(this.ds.getDecoderFact());

        if (offset > 0)
            cursor.skip(offset);
        if (limit > 0)
            cursor.limit(limit);
        if (batchSize > 0)
            cursor.batchSize(batchSize);
        if (snapshotted)
            cursor.snapshot();
        if (sort != null)
View Full Code Here

        logger.info("Executing MongoDB 'find' query: {}", query);
        DBCursor cursor = collection.find(query);

        if (maxRows > 0) {
            cursor = cursor.limit(maxRows);
        }
        if (firstRow > 1) {
            final int skip = firstRow - 1;
            cursor = cursor.skip(skip);
        }
View Full Code Here

                // Perform the operation here only.
                Mongo mongoInstance = authService.getMongoInstance(connectionId);
                long count = mongoInstance.getDB(dbName).getCollection(collectionName).count();
                DBCursor cursor = mongoInstance.getDB(dbName).getCollection(collectionName).find();
                if (!allKeys)
                    cursor.limit(10);
                DBObject doc = new BasicDBObject();
                Set<String> completeSet = new HashSet<String>();
                while (cursor.hasNext()) {
                    doc = cursor.next();
                    getNestedKeys(doc, completeSet, "");
View Full Code Here

      if (mongoQuery.getSort() != null)
        resultCursor = resultCursor.sort(mongoQuery.getSort());

      if (mongoQuery.getLimit() != null)
        resultCursor = resultCursor.limit(mongoQuery.getLimit());

      boolean createCursor = Boolean.TRUE.equals(options.get(Options.OPTION_QUERY_CURSOR));

      if (createCursor)
      {
View Full Code Here

      try {
        if (query.getSkip() > 0) {
          cursorToUse = cursorToUse.skip(query.getSkip());
        }
        if (query.getLimit() > 0) {
          cursorToUse = cursorToUse.limit(query.getLimit());
        }
        if (query.getSortObject() != null) {
          DBObject sortDbo = type != null ? getMappedSortObject(query, type) : query.getSortObject();
          cursorToUse = cursorToUse.sort(sortDbo);
        }
View Full Code Here

    addCommonCriteria(criteria, mongoCriteria);

    DBCursor cursor = col.find(mongoCriteria, null);
    if (criteria != null) {
      cursor.skip(criteria.getLowerLimit());
      cursor.limit(criteria.getNumRecords());
    }

    while(cursor.hasNext()) {
      BasicDBObject object = (BasicDBObject) cursor.next();
View Full Code Here

    if ( queryParameters.getRowSelection().getFirstRow() != null ) {
      cursor.skip( queryParameters.getRowSelection().getFirstRow() );
    }

    if ( queryParameters.getRowSelection().getMaxRows() != null ) {
      cursor.limit( queryParameters.getRowSelection().getMaxRows() );
    }

    return new MongoDBResultsCursor( cursor, entityKeyMetadata );
  }
View Full Code Here

        DBCursor cursor = dbCollection.find(query);
        if (firstResult != -1) {
            cursor.skip(firstResult);
        }
        if (maxResults != -1) {
            cursor.limit(maxResults);
        }
        if (sort != null) {
            cursor.sort(sort);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.