0

I'm using replication set with 3 members, this is the code for firing mapreduce

var db=new mongodb.Db('sns',replSet,{"readPreference":"secondaryPreferred", "safe":true});
....
collection.mapReduce(Account_Map,Account_Reduce,{out:{'replace': 'log_account'},query:queryObj},function(err,collection){};

Then my primary died and restarted, but voted becoming a secondary, and there remains a collection sns.tmp.mr.account_0 instead of log_account. I'm very new to mongodb, I really want to figure out what the promblem is.

2015-02-06T14:04:34.443+0800 [conn87299] build index on: sns.tmp.mr.account_0_inc properties: { v: 1, key: { 0: 1 }, name: "_temp_0", ns: "sns.tmp.mr.account_0_inc" }
2015-02-06T14:04:34.443+0800 [conn87299]added index to empty collection
2015-02-06T14:04:34.457+0800 [conn87299] build index on: sns.tmp.mr.account_0 properties: { v: 1, key: { _id: 1 }, name: "_id_", ns: "sns.tmp.mr.account_0" }
Kevin Brady
  • 1,684
  • 17
  • 30
Jonathan
  • 33
  • 5
  • Is there a problem, like an error message or something? Can you post it? You should probably get rid of the temp M/R collection too. – wdberkeley Feb 06 '15 at 16:11
  • thanks, wdberkeley, i just removed the tmp collection and it works fine now. `{"readPreference":"secondaryPreferred"}` should not be used with M/R operation – Jonathan Mar 31 '15 at 08:34

0 Answers0