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

Source

Obj[] findAll()

Returns a list of entities that match the query.

@see afMongo::Collection.findAll

findCount

Source

Int findCount()

Returns the number of documents that would be returned by the query.

@see afMongo::Collection.findCount

findOne

Source

Obj? findOne(Bool checked := true)

An (optomised) method to return one document from the query.

Throws MongoErr if no documents are found and checked is true, returns null otherwise. Always throws MongoErr if the query returns more than one document.

@see afMongo::Collection.findOne

limit

Source

This limit(Int limit)

Limits the fetched result set to a certain number of values. A value of null or 0 indicates no limit.

Only used by findAll().

make

Source

new make(Datastore datastore, Query query)

Creates a QueryExecutor to run the given query against the datastore.

mongoQuery

Source

Str:Obj? mongoQuery()

Returns a Mongo document representing the query. May be used by Datastore and Collection methods such as findAndUpdate(...).

orderBy

Source

This orderBy(Str fieldName)

Specifies a property / field to use for ordering.

Ordering is ascending by default. Prefix the name with - to specify a descending order.

Multiple calls to orderBy() may be made to indicate sub-sorts. Example:

QueryExecutor(...).orderBy("name").orderBy("-value").findAll

Note this is actually the MongoDB property name and not the field name. Though, the two are usually the same unless you use the @Property.name attribute.

orderByIndex

Source

This orderByIndex(Str indexName)

Specifies an index to use for sorting.

Source

This skip(Int skip)

Starts the query results at a particular zero-based offset.

Only used by findAll().