match static method

Map<String, Object> match(
  1. List<Map<String, Object?>> matches
)

Constructs a MongoDB $match aggregation stage for filtering documents.

The $match stage filters the documents to pass only the documents that match the specified condition(s) to the next pipeline stage.

matches A list of match conditions to combine

Example:

var query = DQ.match([
  DQ.field('status', 'active'),
  DQ.field('age', DQ.gte(18))
]);
// { '$match': { 'status': 'active', 'age': { '$gte': 18 } } }

Implementation

static Map<String, Object> match(List<Map<String, Object?>> matches) {
  return {
    '\$match': {for (var match in matches) ...match}
  };
}