Search⌘ K
AI Features

Write Query: Delete a Record

To comply with the company's data retention policy, all shipped orders placed before January 1, 2025, must be deleted from the orders collection. The task involves executing a delete query that targets documents with a status of "Shipped" and an orderDate prior to the specified cutoff. The expected output will confirm the operation's success, indicating the number of deleted documents.

We'll cover the following...

Question

Given the following sample documents from the orders collection:

[
  {
    "_id": "3a758b14e7e292cf190b1ac5",
    "customerId": "ee3c04494293e51a48af88d1",
    "items": [
      "External Hard Drive",
      "USB Hub"
    ],
    "total": 1922,
    "status": "Processing",
    "orderDate": ISODate("2024-07-05T00:00:00Z")
  },
  {
   
...