Search⌘ K
AI Features

Write Query: Using Regular Expressions

Learn how to filter MongoDB documents using multiple conditions, including field comparisons and pattern matching.

We'll cover the following...

Question

Given the following sample documents from the customers collection:

[
  {
    "_id": "ee3c04494293e51a48af88d1",
    "name": "Michael Carter",
    "email": "michael.carter@gmail.com",
    "phone": "+1-206-555-0142",
    "address": {
      "street": "1206 Pine St",
      "city": "Seattle",
      "state": "WA",
      "postalCode": "98101",
      "country": "US"
    },
    "ordersCount": 3
  },
  {
    "_id": "f9437b18a248488827a75532",
    "name": "Emma Johnson",
    "email":
...