Server Enumerable Objects

New in package 166

Enumerable objects

The Server uses enumerable objects to expose database data.
Examples of enumerable objects include Database.query

Methods

Method Description
[forEach]( callback [, scope] ) forEach executes the provided callback once for each element of the enumerable.
The callback is invoked with three arguments in the scope of scope:
  • the element value
  • the element index
  • the enumerable being traversed
[filter]( callback ) filter calls a provided callback function once for each element in the enumerable,
and returns a new enumerable of all the values for which callback returns a true value.
The callback is invoked with three arguments in the scope of scope:
  • the element value
  • the element index
  • the enumerable being traversed
[find]( callback [, scope] ) find iterates through the enumerable, returning the first element for which callback returns a true value.
The callback is invoked with three arguments in the scope of scope:
  • the element value
  • the element index
  • the enumerable being traversed
[concat]( [ (enumerable object | object), ... ] ) concat creates a new enumerable consisting of the elements of the enumerable on which it was called, followed in order by, for each argument,
the elements of that argument (if the argument is an enumerable) or the argument itself (if the argument is not an enumerable).
[map]( callback ) map executes the provided callback once for every element of the enumerable and returns a enumerable of the result(s).
The callback must return a value.
The callback is invoked with three arguments:
  • the element value
  • the element index
  • the enumerable being traversed]
[iterator]( ) returns a javascript iterator of the enumerable
[toArray]( ) returns a javascript array of the enumerable
[first]( ) returns the first element of the enumerable
[first]( n ) returns a javascript array of the first n elements of the enumerable
[last]( ) returns the last element of the enumerable
[last]( n ) returns a javascript array of the last n elements of the enumerable
[distinct]( ) returns a javascript array of the distinct elements of the enumerable
[distinct]( [field, ...] ) returns a javascript array of the elements with distinct values of field field for all supplied arguments
[count]( ) returns an integer count of the number of elements in the enumerable
[count]( criteria_object ) returns an integer count of the number of elements in the enumerable which satisfy the conditions of the criteria_object
[max]( field_name ) returns the largest value for field field_name
[min]( field_name ) returns the smallest value for field field_name
[any]( ) returns true if enumerable contains any elements
[any]( criteria_object ) returns true if enumerable contains any elements which satisfy the conditions of the criteria_object
[all]( criteria_object ) returns true if any element of the enumerable satisfies the conditions of the criteria_object
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.