Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Filter

Index

Properties

Properties

$filter: { input: ArrayExpression<any>; as?: string; cond: BooleanExpression; limit?: NumberExpression }

Selects a subset of the array to return an array with only the elements that match the filter condition.

version

3.2

see

https://docs.mongodb.com/manual/reference/operator/aggregation/filter/#mongodb-expression-exp.-filter

Type declaration

  • input: ArrayExpression<any>

    An expression that resolves to an array.

  • Optional as?: string

    A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this.

  • cond: BooleanExpression

    An expression that resolves to a boolean value used to determine if an element should be included in the output array. The expression references each element of the input array individually with the variable name specified in as.

  • Optional limit?: NumberExpression

    A number expression that restricts the number of matching array elements that $filter returns. You cannot specify a limit less than 1. The matching array elements are returned in the order they appear in the input array.

    If the specified limit is greater than the number of matching array elements, $filter returns all matching array elements. If the limit is null, $filter returns all matching array elements.

    version

    5.2

    see

    https://www.mongodb.com/docs/manual/reference/operator/aggregation/filter/#using-the-limit-field

Generated using TypeDoc