array=('Brand' 'BrandInfo' 'BrandBaojia' 'VehicleType' 'BrandBaoyang' 'Youhui' 'Config' \ 'Comment' 'OwnerPrice' 'Article' 'UsedCar' 'Video' 'MallGCT' 'MallImport' \ 'Baike' \ 'MachineOil' \ 'Tire' \ 'Yanghu' \ 'Chepin' \ 'Product' \ 'NewCar' \ 'Daogou' \ 'Tech' \ 'Pingce' \ 'Hangjia' \ 'Picture' \ 'Gaizhuang' \ 'Hangye' \ 'MotoSport' \ 'Culture' \ 'Keji' \ 'Chedai' \ 'Hangqing' \ 'BrandDealer' \ 'DealerIndex' \ 'Dealer' \ 'DealerOther' \ 'DealerNews' \ 'DealerModel' \ 'DealerMarket' \ 'DealerContact' \ 'DealerOtherPrice' \ ) for var in ${array[@]} do mongoexport -d PCauto_tit -c $var -o $var.txt done echo '------------ finished export ---------------'
用 shell 脚本将 mongodb 中的 PCauto_tit 库中的各个表导出为以各表名命名的 txt 文件。