classafMorphia::QueryExecutor
sys::Obj afMorphia::QueryExecutor
Executes Query objects against a Datastore. Example:
QueryExecutor(datastore, query).skip(10).limit(50).orderBy("name").findAll
Or you can use the instance returned by Datastore.query(...):
datastore.query(query).orderBy("name").findAll
- findAll
- Obj[] findAll()- Returns a list of entities that match the query. 
- findCount
- Int findCount()- Returns the number of documents that would be returned by the query. 
- findOne
- Obj? findOne(Bool checked := true)- An (optimised) method to return one document from the query. - Throws - MongoErrif no documents are found and- checkedis- true, returns- nullotherwise. Always throws- MongoErrif the query returns more than one document.
- limit
- Limits the fetched result set to a certain number of values. A value of - nullor- 0indicates no limit.- Only used by - findAll().
- make
- new make(Datastore datastore, Query query)- Creates a - QueryExecutorto run the given query against the datastore.
- mongoQuery
- Returns a Mongo document representing the query. May be used by Datastore and Collection methods such as - findAndUpdate(...).
- orderBy
- This orderBy(Obj name, Int sortOrder := Index.ASC)- Specifies a property / field to use for ordering. - namemay either an entity- Fieldannotated with- @Propertyor a MongoDB property name (Str). If passing a- Str, it may be prefixed with- -to specify a descending order, otherwise ordering defaults to ascending.- Multiple calls to - orderBy()may be made to indicate sub-sorts. Example:- QueryExecutor(...).orderBy("name").orderBy("-value").findAll
- orderByIndex
- This orderByIndex(Str indexName)- Specifies an index to use for sorting. 
- skip
- Starts the query results at a particular zero-based offset. - Only used by - findAll().