---
# System prepended metadata

title: Untitled

---

```
db.reservations.aggregate([
    {
        $lookup: {
            from: "rooms",
            localField: "room_id",
            foreignField: "_id",
            as: "room"
        }
    },
    {
        $match: {
            "room.type": "Double"
        }
    },
    {
        $group: {
            _id: "$room",
            total_value: {$sum: "$total_value"}
        }
    }
 ])
```