Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

$unwind

  • $unwind

`` db.scores.aggregate( [ { $unwind: "$scores" } ] );

{ "result": [ { "_id": ObjectId("5988c63dd474ca272db3fb2e"), "name": "foo", "scores": 2 }, { "_id": ObjectId("5988c63dd474ca272db3fb2e"), "name": "foo", "scores": 4 }, { "_id": ObjectId("5988c63dd474ca272db3fb2e"), "name": "foo", "scores": 6 }, { "_id": ObjectId("5988c676d474ca272db3fb2f"), "name": "bar", "scores": 9 }, { "_id": ObjectId("5988c676d474ca272db3fb2f"), "name": "bar", "scores": 5 }, { "_id": ObjectId("5988c676d474ca272db3fb2f"), "name": "bar", "scores": 3 }, { "_id": ObjectId("5988c676d474ca272db3fb2f"), "name": "bar", "scores": 1 } ], "ok": 1 }




<!-- mdbook-embedify [footer]  -->
<style> footer { text-align: center; text-wrap: balance; margin-top: 5rem; display: flex; flex-direction: column; justify-content: center; align-items: center; } footer p { margin: 0; }</style><footer><p>Copyright © 2025 • Created with ❤️ by <a href="https://szabgab.com/">Gábor Szabó</a></p></footer>