You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

filter()

Usage

filter(collection, filterExpression)

Description
Filters the given collection according to the given filter expression, returning a subset of the original collection. The filter expression can be any valid expression that returns a boolean value. This method can be used to remove single or multiple elements from an existing list of objects. The individual objects of the collection are passed into the filter expression sequentially, using the data key data.

The function will remove any object from the collection for which the filter expression returns false.

Note: If you are using JavaScript you should use JavaScripts own Array.prototype.filter() instead.

Example

${filter(find('User'), not(equal(data.name, 'admin')))}

results in

unfiltered: [admin, user1, user2, user3]
filtered:   [user1, user2, user3]

Search results for "filter()"

filter()

Filters the given collection according to the given filter expression, returning a subset of the original collection. The filter expression can be any valid expression that returns a boolean value. This method can be used to remove single or multiple elements from an existing list of objects. The individual objects of the collection are passed into the filter expression sequentially, using the data key data.

The function will remove any object from the collection for which the filter expression returns false.

filter(collection, filterExpression)