Write Query: Create a Compound Index
Understand how to create a compound index on customerId and orderDate fields in MongoDB to improve query efficiency. This lesson helps you optimize search and sort operations on collections with growing data volumes for better performance.
We'll cover the following...
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"
...