like static method

Map<String, Object?> like(
  1. String value, {
  2. String options = 'i',
})

Matches documents where the field's value matches a regular expression.

The options parameter can be used to set regex options (e.g., 'i' for case-insensitive).

Example:

var query = DQ.like('pattern', options: 'i'); // { '\$regex': 'pattern', '\$options': 'i' }

Implementation

static Map<String, Object?> like(String value, {String options = 'i'}) {
  value = _escapeRegex(value);

  return {
    '\$regex': value,
    '\$options': options,
  };
}