var rds = db.REGIPATIENTREC.find({mzh:{$lt:"0"},usrOrg:"石景山中西医结合医院"});

var show = function(value,index,ar){
var rds = db.REGIPATIENTREC.find({"_id": value._id});
while(rds.hasNext()){
var rd = rds.next();
var stime = rd.stime.substring(0,5);
var mzh = rd.mzh.substring(1,9);
var mzhformat = mzh.substring(0,4) + "-" + mzh.substring(4,6) + "-" + mzh.substring(6,8);
var rq = mzhformat + " " + stime;

var id = rd._id;
rd.rq = rq;
rd.stime = mzhformat+" 00:00";
db.REGIPATIENTREC.update({_id:id},{$set:rd});
}
}
rds.forEach(show);

05-21 11:43