The output from MongoDB's map/reduce includes something like 'counts': {'input': I, 'emit': E, 'output': O}
. I thought I clearly understand what those mean, until I hit a weird case which I can't explain.
According to my understanding, counts.input
is the number of rows that match the condition (as specified in query
). If so, how is it possible that the following two queries have different results?
db.mycollection.find({MY_CONDITION}).count()
db.mycollection.mapReduce(SOME_MAP, SOME_REDUCE, {'query': {MY_CONDITION}}).counts.input
I thought the two should always give the same result, independent of the map and reduce functions, as long as the same condition is used.