/** * 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 CountOptions skip(final int skip) { options.skip(skip); return this; }
/** * Get the count of documents in collection that would match a criteria. * * @param query specifies the selection criteria * @param projection this is ignored * @param limit limit the count to this value * @param skip number of documents to skip * @param readPreference {@link ReadPreference} to be used for this operation * @return the number of documents that matches selection criteria * @throws MongoException if the operation failed * @mongodb.driver.manual reference/command/count/ Count * @deprecated Prefer {@link #count(DBObject, DBCollectionCountOptions)} */ @Deprecated public long getCount(@Nullable final DBObject query, @Nullable final DBObject projection, final long limit, final long skip, final ReadPreference readPreference) { return getCount(query, new DBCollectionCountOptions().limit(limit).skip(skip).readPreference(readPreference)); }
/** * Counts the number of objects matching the query this does take limit/skip into consideration * * @return the number of objects * @throws MongoException if the operation failed * @see #count() */ public int size() { DBCollectionCountOptions countOptions = getDbCollectionCountOptions().skip(findOptions.getSkip()).limit(findOptions.getLimit()); return (int) collection.getCount(getQuery(), countOptions); }
/** * 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 CountOptions skip(final int skip) { options.skip(skip); return this; }
/** * Get the count of documents in collection that would match a criteria. * * @param query specifies the selection criteria * @param projection this is ignored * @param limit limit the count to this value * @param skip number of documents to skip * @param readPreference {@link ReadPreference} to be used for this operation * @return the number of documents that matches selection criteria * @throws MongoException if the operation failed * @mongodb.driver.manual reference/command/count/ Count * @deprecated Prefer {@link #count(DBObject, DBCollectionCountOptions)} */ @Deprecated public long getCount(@Nullable final DBObject query, @Nullable final DBObject projection, final long limit, final long skip, final ReadPreference readPreference) { return getCount(query, new DBCollectionCountOptions().limit(limit).skip(skip).readPreference(readPreference)); }
/** * Counts the number of objects matching the query this does take limit/skip into consideration * * @return the number of objects * @throws MongoException if the operation failed * @see #count() */ public int size() { DBCollectionCountOptions countOptions = getDbCollectionCountOptions().skip(findOptions.getSkip()).limit(findOptions.getLimit()); return (int) collection.getCount(getQuery(), countOptions); }