码迷,mamicode.com
首页 > 数据库 > 详细

mongo/mysql , 字段添加"-00"

时间:2014-12-15 20:20:39      阅读:244      评论:0      收藏:0      [点我收藏+]

标签:style   io   ar   color   os   sp   for   on   数据   

============================================================
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‘;

mongo/mysql , 字段添加"-00"

标签:style   io   ar   color   os   sp   for   on   数据   

原文地址:http://blog.csdn.net/a3470194/article/details/41947593

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!