(8) mongodb Import Export

Export Export mongodb into binary format export and export csv json format

Export client path mongodb / bin / mongoexport

Export parameters introduced:

   -d: library name, -c: collection name, -f: field column names, -q: query, -o: file name of the export, - csv export csv format, -h server

Example: Export goods shop library table, the column is export type, code, name, onclick, export conditions for the code that begins ddys00, after export by default stored in the root directory mongodb

  ./bin/mongoexport -d shop -c goods -f type,code,name,onclick -q '{code:/ddys00.*/}' -o goods-shop.json

  ./bin/mongoexport -h 192.168.31.151 -d shop -c goods -f type,code,name,onclick -q '{code:/ddys00.*/}' -o goods-shop.json

Guess you like

Origin www.cnblogs.com/javasl/p/11293655.html