• mongoexport导出数据


    mongoexport用法:

    /*****

    Export MongoDB data to CSV, TSV or JSON files.
    options:
      --help                                produce help message
      -v [ --verbose ]                      be more verbose (include multiple times
                                            for more verbosity e.g. -vvvvv)
      --version                             print the program's version and exit
      -h [ --host ] arg                     mongo host to connect to ( <set
                                            name>/s1,s2 for sets)
      --port arg                            server port. Can also use --host
                                            hostname:port
      --ipv6                                enable IPv6 support (disabled by
                                            default)
      --ssl                                 use SSL for all connections
      -u [ --username ] arg                 username
      -p [ --password ] arg                 password
      --authenticationDatabase arg          user source (defaults to dbname)
      --authenticationMechanism arg (=MONGODB-CR)
                                            authentication mechanism
      --dbpath arg                          directly access mongod database files
                                            in the given path, instead of
                                            connecting to a mongod  server - needs
                                            to lock the data directory, so cannot
                                            be used if a mongod is currently
                                            accessing the same path
      --directoryperdb                      each db is in a separate directly
                                            (relevant only if dbpath specified)
      --journal                             enable journaling (relevant only if
                                            dbpath specified)
      -d [ --db ] arg                       database to use
      -c [ --collection ] arg               collection to use (some commands)
      -f [ --fields ] arg                   comma separated list of field names
                                            e.g. -f name,age
      --fieldFile arg                       file with fields names - 1 per line
      -q [ --query ] arg                    query filter, as a JSON string
      --csv                                 export to csv instead of json
      -o [ --out ] arg                      output file; if not specified, stdout
                                            is used
      --jsonArray                           output to a json array rather than one
                                            object per line
      -k [ --slaveOk ] arg (=1)             use secondaries for export if
                                            available, default true
      --forceTableScan                      force a table scan (do not use
                                            $snapshot)
    /****/

    具体例子(导出特定表中数据为csv格式)

    mongoexport -h IP --port 端口 -u 用户名 -p 密码 -d 数据库 -c 表名 -f 字段1,字段2 -q‘{条件导出}’ --csv -o 文件名

  • 相关阅读:
    linux 常用awk命令
    plsql连接oralce数据的配置 PLSQL配置怎么连ORACLE plsql连接多个数据库设置 Oracle 服务命名(别名)的配置及原理,plsql连接用
    PLSQL连接ORACLE配置字符串简介 oracle网络配置 三个配置文件 listener.ora、sqlnet.ora、tnsnames.ora原理解释
    OLEDB和ODBC的区别(优缺点)
    ADO,OLEDB,ODBC,DAO,RDO的区别说明
    Android开发在路上:少去踩坑,多走捷径
    手机淘宝构架演化实践
    车​险​与​非​车​险​基础分​类​和​说​明
    192.168.1.1地址,路由器地址打不开怎么办?
    一般测试流程 常用的软件测试工具有哪些? 开源测试工具 软件测试一般用到的工具、框架、技术列表
  • 原文地址:https://www.cnblogs.com/biang/p/5689258.html
Copyright © 2020-2023  润新知