public class Finder extends QueryBuilder<Finder>
filterObject, FILTERS, mixing, mongo
Modifier and Type | Method and Description |
---|---|
void |
allIn(Class<?> type,
Consumer<Doc> processor)
Executes the query for the given collection and calls the given processor for each document.
|
void |
allIn(String collection,
Consumer<Doc> processor)
Executes the query for the given collection and calls the given processor for each document.
|
long |
countIn(Class<?> type)
Counts the number of documents in the result of the given query.
|
long |
countIn(String collection)
Counts the number of documents in the result of the given query.
|
void |
eachIn(Class<?> type,
Function<Doc,Boolean> processor)
Executes the query for the given collection and calls the given processor for each document as long as it
returns true.
|
void |
eachIn(String collection,
Function<Doc,Boolean> processor)
Executes the query for the given collection and calls the given processor for each document as long as it
returns true.
|
Finder |
limit(int limit)
Adds a limit to the query.
|
Finder |
limit(int skip,
int limit)
Adds a limit to the query.
|
Finder |
orderByAsc(Mapping field)
Adds a sort constraint to order by the given field ascending.
|
Finder |
orderByAsc(String field)
Adds a sort constraint to order by the given field ascending.
|
Finder |
orderByDesc(Mapping field)
Adds a sort constraint to order by the given field descending.
|
Finder |
orderByDesc(String field)
Adds a sort constraint to order by the given field descending.
|
Finder |
selectFields(Mapping... fieldsToReturn)
Limits the fields being returned to the given list.
|
Finder |
selectFields(String... fieldsToReturn)
Limits the fields being returned to the given list.
|
Optional<Doc> |
singleIn(Class<?> type)
Executes the query for the given collection and returns a single document.
|
Optional<Doc> |
singleIn(String collection)
Executes the query for the given collection and returns a single document.
|
Finder |
skip(int skip)
Specifies the number of items to skip before items are added to the result.
|
getRelationName, toString, traceIfRequired, transferFilters, where, where, where
protected Finder(Mongo mongo)
public Finder selectFields(Mapping... fieldsToReturn)
fieldsToReturn
- specified the list of fields to returnpublic Finder selectFields(String... fieldsToReturn)
fieldsToReturn
- specified the list of fields to returnpublic Finder orderByAsc(Mapping field)
field
- the field to order by.public Finder orderByAsc(String field)
field
- the field to order by.public Finder orderByDesc(Mapping field)
field
- the field to order by.public Finder orderByDesc(String field)
field
- the field to order by.public Finder limit(int skip, int limit)
skip
- the number of items to skip (used for pagination).limit
- the max. number of items to return (exluding those who have been skipped).public Finder limit(int limit)
This is boilerplate for finder.limit(0, limit)
.
limit
- the max. number of items to returnpublic Finder skip(int skip)
skip
- the number of items to skip. Value <= 0 are ignored.public Optional<Doc> singleIn(Class<?> type)
type
- the type of entities to searchpublic Optional<Doc> singleIn(String collection)
collection
- the collection to search inpublic void eachIn(Class<?> type, Function<Doc,Boolean> processor)
type
- the type of entities to searchprocessor
- the processor to handle matches, which also controls if further results should be processedpublic void eachIn(String collection, Function<Doc,Boolean> processor)
collection
- the collection to search inprocessor
- the processor to handle matches, which also controls if further results should be processedpublic void allIn(Class<?> type, Consumer<Doc> processor)
type
- the type of entities to searchprocessor
- the processor to handle matchespublic void allIn(String collection, Consumer<Doc> processor)
collection
- the collection to search inprocessor
- the processor to handle matchespublic long countIn(Class<?> type)
Note that limits are ignored for this query.
type
- the type of entities to searchpublic long countIn(String collection)
Note that limits are ignored for this query.
collection
- the collection to search inCopyright © 2018. All rights reserved.