mongo/mysql , 欄位添加"-00",mongo-00

來源:互聯網
上載者:User

mongo/mysql , 欄位添加"-00",mongo-00
============================================================Phil-PROD-20141212,欄位添加"-00"=========
現需要對線上墊付寶資料與輕易貸關聯的資料有問題的資料進行修改(批量)
mongodb
bindingloan
需要對 loanAccountId後加 ‘-00’

MySql需要將 select LoanAccountId from KyPayAccounts
LoanAccountId 後沒有-00的 記錄加上 ‘-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 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';

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.