zoukankan      html  css  js  c++  java
  • MongoDB 学习笔记之 MongoDB导入导出

    MongoDB数据导入导出:

    mongoexport:

    -host 机器

    -port 端口

    -u 用户名

    -p 密码

    -d 库名

    -c 表名

    -f 列名

    -o 导出的文件名

    -q 查询条件

    --csv 导出csv格式

    ./mongoexport --host hadoop1 --port 27017 -u sky -p **** --authenticationDatabase=admin -d test -c bar -f title,content -q '{_id: {$lte: 10}}' -o ./test.bar.json --csv

    mongoimport:

    -d 导入到的数据库

    -c 导入到的表

    --type csv/json(默认)

    --file 备份文件路径

    ./mongoimport --host hadoop1 --port 27017 -u sky -p ***** --authenticationDatabase=admin -d test -c bar2 --type csv --fields title,content --file ./test.bar.json

     

    ./mongoimport --host hadoop1 --port 27017 -u sky -p ***** --authenticationDatabase=admin -d test -c bar2 --type csv --headerline --file ./test.bar.json

    mongodump:

    mongodump 导出二进制bson结构数据及其索引信息。

    -d 库名

    -c 表名

    -f 列名

    ./mongodump --host hadoop1 --port 27017 -u sky -p ***** --authenticationDatabase=admin -d test

    mongorestore:

    mongorestore 导入二进制文件。

    ./mongorestore --host hadoop1 --port 27017 -u sky -p ***** --authenticationDatabase=admin --db test2  dump/test

  • 相关阅读:
    清除微信浏览器缓存
    JS实现HTML标签转义及反转义
    mvc中服务器端、客户端属性验证
    Ajax.ActionLink参数详解
    Ajax.BeginForm参数详解
    AjaxHelper简介
    将博客搬至CSDN
    Sequelize小记
    端口: 查看端口状态
    搭建git服务器
  • 原文地址:https://www.cnblogs.com/AK47Sonic/p/7368510.html
Copyright © 2011-2022 走看看