When I'm running Map-Reduce on a Mongo database, I usually get results similar to the following:
{ _id: <some-id>, value: { <first-key>: <first-value>, ... } }
Is there a way to omit the value: { ... }
part and directly insert the content of value
in the result? Basically, I'd like to have a result that looks like the following:
{ _id: <some-id>, <first-key>: <first-value>, ... }
This way I could merge the results back into an existing collection that obeys this format.
I also have an other question regarding Map-Reduce: Is it possible to access another collection from withing a map
or reduce
function?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…