I have a Mongodb document that contains an array of bookings like this:
{ id: myId,
bookings: [
{station: "Nurse"},
{station: "Doctor"},
{station: "Pharmacist"}
]
}
I have a view for each station where they see all records that are booked next. So for the Nurse, this would be: find({"bookings.0.station": "Nurse"}), returning every record where the nurse is the first element in the bookings array.
What I would like to add is a second view where all subsequent bookings can be seen, ie. records where the nurse is the nth booking for n > 0.
Is there a trivial way to do this? Or am I better off retrieving all documents first and then filtering on the actual document?