Using the m/r function with an $or query appears to be impossible right now. We are using the query below for one of our map reduces and are getting this error:
SyntaxError: invalid property id
mongo mentions line 78; below are lines 73-84:
db.runCommand({
mapreduce : "clients_raw",
map : m,
reduce : r,
query : {
{ "_id.DAY": "2012-06-22" , $or : [ {"_id.CLIENT_ID": 123}, {"_id.CLIENT_ID": 456} ] }
},
out : {
merge : "clients"
},
finalize : f
});
Running the query through a find generates the results we expect; removing the $or condition, too, generates results we expect. It seems as if combining $or with another field however, is not possible at this point.