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 ---------------'
Use the shell script to export each table in the PCauto_tit library in mongodb as a txt file named after each table name.