update other collection when mapReduce
ruby
rubik at sina.com
Mon Nov 29 08:48:01 UTC 2010
is mapReduce readonly?
try to update other collection when mapReduce :
db.things.remove()
db.things2.remove()
db.things.save({test:1})
db.things2.save({test2:2})
m=function(){
t=db.things.findOne()
t.test = this.test2
db.things.save(t)
emit(this.test2,1)
}
r=function(k,vals){ return vals[0]}
db.things.find()
db.things2.find()
res=db.things2.mapReduce(m,r)
db.things.find()
but failed.
More information about the Mercurial
mailing list