Given the following layout in a collection...
{
vehicle_id: 1
,// bunch of properties I don't want
,vehicle: {
mfg_year: 1928
,mfg_make: "Ford"
,mfg_model: "Model A"
,mfg_trim: "T-Bucket"
,// bunch of properties I don't want
,images: [
{url:'...',...}
,...
]
}
}
How would I return a result with only the above fields, and only the first result under images? I don't mind if the results are in one flattened object, with only the images being a nested object.
I've looked into the Aggregation Framework, which doesn't seem to match what I am looking for. I know I could do a map/reduce on the results set, or do a group on the listing_id, am just hoping to have a simpler query structure without needing to resort to group, or reduce.
If this isn't possible currently via the aggregation framework, a working group or map-reduce would be an acceptable answer.
EDIT: There are about 50+ properties that I don't want in the final result.. with the $slice directive, it seems I can't just specify the fields I want.