Class: Constraint

ServerlessDb.Constraint

Represents constraints on the values of data nodes sent by subscriptions.

Instances of this class are built using one of its static members, which can be accessed using the Constraint property of the Webcom.ServerlessDb static property.

Members

(static, readonly) None :ServerlessDb.Constraint

No constraint: the values of data nodes are sent without filtering any child node.

Type:

Methods

(static) Between(startKey, endKey) → {ServerlessDb.Constraint}

Children between: the values of data nodes sent by subscriptions will be limited to the child nodes of the actual data nodes whose keys are between startKey and endKey (included).

Child nodes are ordered with respect to their keys in a dedicated lexicographic order. For example, if the actual data node to send is {a:9, b:8, c:7}, the Between("a", "abc") constraint will send {a:9} to notification targets.

Parameters:
Name Type Description
startKey string

Key that is lower than or equals (following the lexicographic order) the key of the first child that can be sent by subscriptions.

endKey string

Key that is greater than or equals (following the lexicographic order) the key of the last child that can be sent by subscriptions.

Returns:
Type
ServerlessDb.Constraint

(static) EndAt(endKey, limitopt) → {ServerlessDb.Constraint}

limit children until endKey: the values of data nodes sent by subscriptions will be limited to the last limit child nodes (or all child nodes if limit is not set) of the actual data nodes whose keys are lesser than or equal endKey.

Child nodes are ordered with respect to their keys in a dedicated lexicographic order. For example, if the actual data node to send is {a:9, b:8, c:7}, the EndAt("cba", 2) constraint will send {b:8, c:7} to notification targets.

Parameters:
Name Type Attributes Description
endKey string

Key that is greater than or equals (following the lexicographic order) the key of the last child that can be sent by subscriptions.

limit number <optional>
Returns:
Type
ServerlessDb.Constraint

(static) First(limit) → {ServerlessDb.Constraint}

First limit children: the values of data nodes sent by subscriptions will be limited to the first limit child nodes of the actual data nodes.

Child nodes are ordered with respect to their keys in a dedicated lexicographic order. For example, if the actual data node to send is {a:9, b:8, c:7}, the First(2) constraint will send {a:9, b:8} to notification targets.

Parameters:
Name Type Description
limit number

Maximum number of children that can be sent by subscriptions, starting from the first one in lexicographic order.

Returns:
Type
ServerlessDb.Constraint

(static) Last(limit) → {ServerlessDb.Constraint}

Last limit children: the values of data nodes sent by subscriptions will be limited to the last limit child nodes of the actual data nodes.

Child nodes are ordered with respect to their keys in a dedicated lexicographic order. For example, if the actual data node to send is {a:9, b:8, c:7}, the Last(2) constraint will send {b:8,c:7} to notification targets.

Parameters:
Name Type Description
limit number

Maximum number of children that can be sent by subscriptions, starting from the last one in lexicographic order.

Returns:
Type
ServerlessDb.Constraint

(static) StartAt(startKey, limitopt) → {ServerlessDb.Constraint}

limit children from startKey: the values of data nodes sent by subscriptions will be limited to the first limit child nodes (or all child nodes if limit is not set) of the actual data nodes whose keys are greater than or equal startKey.

Child nodes are ordered with respect to their keys in a dedicated lexicographic order. For example, if the actual data node to send is {a:9, b:8, c:7}, the StartAt("abc", 1) constraint will send {a:9} to notification targets.

Parameters:
Name Type Attributes Description
startKey string

Key that is lower than or equals (following the lexicographic order) the key of the first child that can be sent by subscriptions.

limit number <optional>

If set, maximum number of children that can be sent by subscriptions from the given startKey.

Returns:
Type
ServerlessDb.Constraint
show
deprecated