/** * Sets the number of documents to skip. * * @param skip the number of documents to skip * @return this * @mongodb.driver.manual reference/method/cursor.skip/#cursor.skip Skip */ public FindOptions skip(final int skip) { options.skip(skip); return this; }
/** * Discards a given number of elements at the beginning of the cursor. * * @param numberOfElements the number of elements to skip * @return a cursor pointing to the new first element of the results * @throws IllegalStateException if the cursor has started to be iterated through */ public DBCursor skip(final int numberOfElements) { findOptions.skip(numberOfElements); return this; }
/** * Copy this DBCollectionFindOptions instance into a new instance. * * @return the new DBCollectionFindOptions with the same settings as this instance. */ public DBCollectionFindOptions copy() { DBCollectionFindOptions copiedOptions = new DBCollectionFindOptions(); copiedOptions.batchSize(batchSize); copiedOptions.limit(limit); copiedOptions.modifiers(modifiers); copiedOptions.projection(projection); copiedOptions.maxTime(maxTimeMS, TimeUnit.MILLISECONDS); copiedOptions.maxAwaitTime(maxAwaitTimeMS, TimeUnit.MILLISECONDS); copiedOptions.skip(skip); copiedOptions.sort(sort); copiedOptions.cursorType(cursorType); copiedOptions.noCursorTimeout(noCursorTimeout); copiedOptions.oplogReplay(oplogReplay); copiedOptions.partial(partial); copiedOptions.readPreference(readPreference); copiedOptions.readConcern(readConcern); copiedOptions.collation(collation); copiedOptions.comment(comment); copiedOptions.hint(hint); copiedOptions.max(max); copiedOptions.min(min); copiedOptions.returnKey(returnKey); copiedOptions.showRecordId(showRecordId); return copiedOptions; }
/** * Discards a given number of elements at the beginning of the cursor. * * @param numberOfElements the number of elements to skip * @return a cursor pointing to the new first element of the results * @throws IllegalStateException if the cursor has started to be iterated through */ public DBCursor skip(final int numberOfElements) { findOptions.skip(numberOfElements); return this; }
/** * Sets the number of documents to skip. * * @param skip the number of documents to skip * @return this * @mongodb.driver.manual reference/method/cursor.skip/#cursor.skip Skip */ public FindOptions skip(final int skip) { options.skip(skip); return this; }
@Override public List<T> results(){ DBObject projection; if(fieldsSpecified){ projection = fields; }else{ projection = dao.getKeyFields(); } DBCollectionFindOptions options = new DBCollectionFindOptions(); options.projection(projection); if(maxTimeMS > 0){ options.maxTime(maxTimeMS, TimeUnit.MILLISECONDS); } if(orderBy != null){ options.sort(SortUtil.getSort(orderBy)); } if(pageNumber>0 && pageSize>0){ options.skip((pageNumber-1) * pageSize); options.limit(pageSize); } DBCollection coll = dao.getCollection(); DBCursor cursor = coll.find(condition, options); return MapperUtil.toList(dao.getEntityClass(), cursor, withoutCascade); }
/** * Copy this DBCollectionFindOptions instance into a new instance. * * @return the new DBCollectionFindOptions with the same settings as this instance. */ public DBCollectionFindOptions copy() { DBCollectionFindOptions copiedOptions = new DBCollectionFindOptions(); copiedOptions.batchSize(batchSize); copiedOptions.limit(limit); copiedOptions.modifiers(modifiers); copiedOptions.projection(projection); copiedOptions.maxTime(maxTimeMS, TimeUnit.MILLISECONDS); copiedOptions.maxAwaitTime(maxAwaitTimeMS, TimeUnit.MILLISECONDS); copiedOptions.skip(skip); copiedOptions.sort(sort); copiedOptions.cursorType(cursorType); copiedOptions.noCursorTimeout(noCursorTimeout); copiedOptions.oplogReplay(oplogReplay); copiedOptions.partial(partial); copiedOptions.readPreference(readPreference); copiedOptions.readConcern(readConcern); copiedOptions.collation(collation); copiedOptions.comment(comment); copiedOptions.hint(hint); copiedOptions.max(max); copiedOptions.min(min); copiedOptions.returnKey(returnKey); copiedOptions.showRecordId(showRecordId); return copiedOptions; }