I can't understand this paragraph from mongodb MapReduce documentation (http://docs.mongodb.org/manual/applications/map-reduce/) - what Temporary Collection (optimisation?) is good for (business case, benefits etc)?
Temporary Collection
The map-reduce operation uses a temporary
collection during processing. At completion, the map-reduce operation
renames the temporary collection. As a result, you can perform a
map-reduce operation periodically with the same target collection name
without affecting the intermediate states. Use this mode when
generating statistical output collections on a regular basis.
Lets say you a collection of documents of the form { a : 1 } and periodically you want the average value of a. Lets also say you wanted to run a map-reduce job that incremented the 'a' field by one for every document. It is possible, however, that while this map reduce was running, the job that also gets the average value of a was running. In this case, if you did not have a temporary collection, the average might be thrown off by the fact that the map reduce job did not yet finish, leaving the collection in an intermediate state.
To avoid this situation, the map reduce job can work in a temporary collection until it finishes. Once it is done, it renames the temporary collection to the target name, effectively swapping in the new one. This way, when you take the average value of "a", you get a value that is not partially affected by the map-reduce job.
Let me know if you would like me to clarify this a bit.