Composite Filters (Reference)

The script content on this page is for navigation purposes only and does not alter the content in any way.

A composite filter specification can appear only at the top level. That is, you cannot nest a composite filter inside another composite filter or inside a filter condition.

A composite filter is an object that has at most one member of each of these clauses:1

The order of the clauses is not significant. Absence of a clause has the same effect as applying its operator to an operand that is an empty object: Absence of a query clause selects all documents; absence of an orderby clause imposes no order.

The following composite filter contains a query clause and an orderby clause. The query clause selects documents that have a salary field whose value is greater than 10,000. The orderby clause sorts the selected documents first by descending age and then by ascending zip code.

{ "$query" : { "salary" : { "gt" : 10000 } },
  "$orderby" : { "age" : -1, "zip" : 2 } }

Related Topics

  1. SODA for REST provides additional clauses for use in a composite filter.