======2014-11-14 数据提取=======
[query@query-server hurl]$ cat test.sh
tlist=`cat ./username.txt`;
for i in $tlist
do
TEMP_LIST=$i;
# printf "$TEMP_LIST\n";
mongo --quiet localhost:27020/che001 -uquery -pquery << EOF
var user_cursor=db.user.find({"username" :'$TEMP_LIST'})
while(user_cursor.hasNext()){
var user2=user_cursor.next();
//print(user2.id+" "+user2.username);
var contract=db.contract.find({"userId":"e213056a-5c0b-4cba-abe0-93704accdf12"},{"number":1})
while(contract.hasNext()){
var contract2=contract.next();
print('db.SAS_BASE_testUserList.insert({"userId":"'+user2.id+'","userName":"'+user2.username+'","contractNo":"'+contract2.number+'"});');
}
}
EOF
done
[query@query-server hurl]$ cat test.sh
tlist=`cat ./username.txt`;
for i in $tlist
do
TEMP_LIST=$i;
# printf "$TEMP_LIST\n";
mongo --quiet localhost:27020/che001 -uquery -pquery << EOF
var user_cursor=db.user.find({"username" :'$TEMP_LIST'})
while(user_cursor.hasNext()){
var user2=user_cursor.next();
//print(user2.id+" "+user2.username);
var contract=db.contract.find({"userId":"e213056a-5c0b-4cba-abe0-93704accdf12"},{"number":1})
while(contract.hasNext()){
var contract2=contract.next();
print('db.SAS_BASE_testUserList.insert({"userId":"'+user2.id+'","userName":"'+user2.username+'","contractNo":"'+contract2.number+'"});');
}
}
EOF
done