标签:命令 cti str datatable name ble ash insert tin
1、mongo提供*.js的方法供linux调用
#!/bin/bash
/usr/local/mongodb/bin/mongo hostname/dbname xxx.js
xxx.js 内容如下
db.getCollection(‘CollectinName‘).drop();
db.getCollection(‘CollectinName‘).insert([
{
"id":"100",
"name":"luyi"
},
{
"id":"200",
"name":"wanger"
}
]}
......
2、把参数传到mongo命令中:
DSID=$1
/usr/local/mongodb/bin/mongo ${hostname}/${dbname} <<-EOF
db.DataTable.remove({"dsId":"$DSID"})
db.Datasource.remove({"dsId":"$DSID"})
exit
EOF
标签:命令 cti str datatable name ble ash insert tin
原文地址:https://www.cnblogs.com/gide/p/9797788.html