Arrived at a map-reduce solution for the problem:
My functions look like this now:
m = function() {
emit(this.a.b.c, { data: [[this.a.b.d, this.a.b.e]] });
}
r = function(key, values) {
var result = [];
values.forEach(function(V) {
Array.prototype.push.apply(result, V.data);
});
return {data: result};
}
db.coll.mapReduce(m, r, {out: {replace: "data"}})
Works out great for this purpose :)