DatabaseQuery

DatabaseQuery

new DatabaseQuery(databaseManager, type)

Class representing a database query.

Parameters:
Name Type Description
databaseManager DatabaseManager

The DatabaseManager.

type string

The type of DatabaseObject to query for.

Members

conditions :any

Type:
  • any

getKey :string

Type:
  • string

getValue :any

Type:
  • any

maxResults :number

Type:
  • number

sort :any

Type:
  • any

subQueries :Array.<SubQuery>

Type:

type :string

Type:
  • string

Methods

(static) and(queries) → {DatabaseQuery}

AND some queries together.

Parameters:
Name Type Description
queries Array.<DatabaseQuery>

The queries to AND.

Returns:

The first query passed in, with the rest as AND SubQueries.

Type
DatabaseQuery

(static) or(queries) → {DatabaseQuery}

OR some queries together.

Parameters:
Name Type Description
queries Array.<DatabaseQuery>

The queries to OR.

Returns:

The first query passed in, with the rest as OR SubQueries.

Type
DatabaseQuery

and(queries) → {this}

AND some queries to this query.

Parameters:
Name Type Description
queries Array.<DatabaseQuery>

The queries to AND.

Returns:

The DatabaseQuery.

Type
this

equalTo(prop, val) → {this}

Add an equalTo condition.

Parameters:
Name Type Description
prop string

The property to check.

val any

The value that the property's value must be equal to.

Returns:

The DatabaseQuery.

Type
this

find() → {Promise.<Array.<DatabaseObject>>}

Execute this query.

Returns:

The DatabaseObject records, if found.

Type
Promise.<Array.<DatabaseObject>>

get(id) → {Promise.<(DatabaseObject|void)>}

Execute this query searching for the given id.

Parameters:
Name Type Description
id string

The ID to search for.

Returns:

The DatabaseObject record, if found.

Type
Promise.<(DatabaseObject|void)>

greaterThan(prop, num) → {this}

Add a greaterThan condition.

Parameters:
Name Type Description
prop string

The property to check.

num number

The number that the property's value must be greater than.

Returns:

The DatabaseQuery.

Type
this

lessThan(prop, num) → {this}

Add a lessThan condition.

Parameters:
Name Type Description
prop string

The property to check.

num number

The number that the property's value must be less than.

Returns:

The DatabaseQuery.

Type
this

limit(num) → {this}

Add a limit condition.

Parameters:
Name Type Description
num number

The number of results to return.

Returns:

The DatabaseQuery.

Type
this

notEqualTo(prop, val) → {this}

Add a notEqualTo condition.

Parameters:
Name Type Description
prop string

The property to check.

val any

The value that the property's value must not be equal to.

Returns:

The DatabaseQuery.

Type
this

or(queries) → {this}

OR some queries to this query.

Parameters:
Name Type Description
queries Array.<DatabaseQuery>

The queries to OR.

Returns:

The DatabaseQuery.

Type
this