Mongo/mysql, field add "-00"

Source: Internet
Author: User
Tags treasure data

============================================================phil-prod-20141212, field add "-00" =========
It is necessary to modify the data of the online advance treasure data and the easy loan related problem data (batch)
Mongodb
Bindingloan
Need to add '-00 ' to Loanaccountid

MySQL requires the Select Loanaccountid from kypayaccounts
Loanaccountid no-00 record plus '-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 Localh OST--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 are not NULL and loanaccountid do like '%-00 ';
UPDATE kypayaccounts SET loanaccountid=concat (loanaccountid, ' -00 ') WHERE Loanaccountid is isn't NULL and Loanaccountid not Like '%-00 ';

Mongo/mysql, field add "-00"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.