Mongo/mysql, field Add "-00", mongo-00
========================================================== ================================= Phil-PROD-20141212, add "-00" ========
You need to modify problematic data (batch) of online dianfu Bao data and easily related data)
Mongodb
Bindingloan
Add '-00' to loanAccountId'
MySql needs to select LoanAccountId from KyPayAccounts
After LoanAccountId, '-00' is added to records without-00'
====================================== Mongo ====== db. bindingloan. find ({}, {"loanAccountId": 1 }). pretty ()
Db. bindingloan. find ({"loanAccountId": {$ not:/\-00 $/}}, {"loanAccountId": 1}). pretty ()
Mongodump -- host localhost -- port 27020-uquery-pquery-d che001-c bindingloan-o. /mongorestore -- drop -- host localhost -- port 27017-uplatform-pplatform-d che001-c bindingloan. bson
Var userf = db. bindingloan. find ({"loanAccountId": {$ not:/\-00 $/}, {"loanAccountId": 1}); while (userf. hasNext () {var userft = userf. next (); var useid = userft. _ id; var uname = userft. loanAccountId; var usename = uname + "-00"; db. bindingloan. save ({"_ id": useid, "loanAccountId": usename}) print (usename );}
======================================== Mysql
Mysqldump-uquery-pquery-h172.24.0.220 -- lock-tables = false -- single-transaction -- default-character-set = utf8 -- set-gtid-purged = OFF che001 KyPayAccounts> KyPayAccounts. SQL
Select concat (LoanAccountId, '-00') FROM KyPayAccounts WHERE LoanAccountId is not null and LoanAccountId not like' %-00 ';
UPDATE KyPayAccounts SET LoanAccountId = CONCAT (LoanAccountId, '-00') WHERE LoanAccountId is not null and LoanAccountId not like' %-00 ';