将test数据库下JobLog表中数据插入JobLogBak表中
- 方式1
local_dt=`date +%H`
if [ $local_dt -eq 0 ]; then
mongo 172.00.00.0:27017/test --eval 'db.JobLog.find().forEach(function(d){db.JobLogBak.insert(d)})'
fi
- 方式2
mongo 172.00.00.0:27017<<EOF
use test
var result = db.JobLog.find()
while(result.hasNext()) db.JobLogBak.insert(result.next())
EOF
网友评论