Nearby lessons
18 of 22🧩 MongoDB: Array and Array Aggregation Operators
MongoDB provides a wide range of Array Operators that help you manipulate, transform, and analyze arrays inside documents.
You can extract elements, merge arrays, filter items, and even perform computations using aggregation pipelines.
📚 Initial Data Setup — studentsArr Collection
1️⃣ $arrayElemAt — Get Element at Index
2️⃣ $firstN — First N Elements
3️⃣ $lastN — Last N Elements
4️⃣ $maxN — N Largest Values
5️⃣ $minN — N Smallest Values
6️⃣ $slice — Extract Subarray
7️⃣ $sortArray — Sort Elements
8️⃣ $reverseArray — Reverse Order
9️⃣ $size — Array Length
🔟 $in — Check Membership
1️⃣1️⃣ $indexOfArray — Find Element Index
1️⃣2️⃣ $isArray — Check If Field Is Array
1️⃣3️⃣ $map — Transform Each Element
1️⃣4️⃣ $filter — Filter Elements
1️⃣5️⃣ $reduce — Compute from Array
1️⃣6️⃣ $range — Generate Sequence
1️⃣7️⃣ $concatArrays — Merge Arrays
1️⃣8️⃣ $zip — Pair Arrays
1️⃣9️⃣ $arrayToObject — Convert Array → Object
2️⃣0️⃣ $objectToArray — Convert Object → Array
Keep Going!MongoDB - Type Operators