Mongo-js-20141126, JavaScript

Source: Internet
Author: User

Mongo-js-20141126, JavaScript
#! /Bin/sh
# Create a 0-byte document. If yes, clear it.
:> SubsidiaryCode.txt
Tlist = 'cat./AccountGuid.txt ';
For I in $ tlist
Do
TEMP_LIST = $ I;
# Print the value obtained from $ TEMP_LIST.
# Printf "AccountGuid: $ TEMP_LIST \ n ";


Mysql-h 172.24.0.220-uquery-pquery che001-NB <EOF> Referal_user_Id.txt
Select ReferalGuid, UserGuid from KyPayAccounts where AccountGuid = '$ TEMP_LIST ';
EOF


# Get Referal_user_Id
Referal_user_Id = 'cat./Referal_user_Id.txt ';
# Determine whether Referal_user_Id is null
If ["$ Referal_user_Id" x = x]
Then
Echo "Error: failed to get AccountGuid $ TEMP_LIST date, Referal_user_Id in not exist! ";
# Exit-1
Fi
ReferalId = 'echo "$ Referal_user_Id" | awk '{print $1 }'';
UserId = 'echo "$ Referal_user_Id" | awk '{print $2 }'';


Mongo -- quiet localhost: 27020/che001-uquery-pquery <EOF> subsidiaryCode.txt
// Mongo -- quiet localhost: 27020/che001-uquery-pquery <EOF
Var subsidiaryCode = "";
Var employee = db. employee. find ({"userId": '$ ReferalId'}, {"store": 1, "logicalDel": 1 })
While (employee. hasNext ()){
Var employee2 = employee. next ();
// Print ("sroteId:" + employee2.store );
If (typeof (employee2.store )! = "Undefined ")
{
Var t_store = employee2.store;
Var logicalDel = employee2.logicalDel;
} Else {
// Print ('$ TEMP_LIST' + "," + '$ ReferalId' + ", employee. store in not exist! ");
Break;
}
Var store = db. store. find ({"id": t_store}, {"subsidiaryInfo. subsidiaryCode": 1 })
While (store. hasNext ()){
Var store2 = store. next ();
// Print ("subsidiaryCode:" + store2.subsidiaryInfo. subsidiaryCode );
Var subsidiaryCode = store2.subsidiaryInfo. subsidiaryCode;
}
Var contract = db. contract. find ({"userId": '$ userid '})
While (contract. hasNext ()){
Var contract2 = contract. next ();
// Print(contract2.data.doc _ cnt_number );
Var doc_cnt_numberw.contract2.data.doc _ cnt_number
}
Var user = db. user. find ({"id": '$ userid '})
While (user. hasNext ()){
Var user2 = user. next ();
// Print (user2.username );
Var username = user2.username
}
Var serviceAccount = db. serviceAccount. find ({"userId": '$ userid '})
While (serviceAccount. hasNext ()){
Var serviceAccount2 = serviceAccount. next ();
// Print (serviceAccount2.fullName );
Var fullName = serviceAccount2.fullName
}
Print ("" + '$ TEMP_LIST' + "," + subsidiaryCode + ", logicalDel:" + logicalDel + "," + doc_cnt_number + "," + username + ", "+ fullName );
}


EOF
Done

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.