- 首先到官网下载工具包,进入下面页面,复制连接地址,使用wget下载
- cd /usr/local/mongodb5.0.14/
- wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-rhel70-x86_64-100.6.1.tgz

- 安装
- tar -zxvf mongodb-database-tools-rhel70-x86_64-100.6.1.tgz #解压
- mv -f mongodb-database-tools-rhel70-x86_64-100.6.1/bin/* bin/ #将bin目录的文件移动到mongo的bin目录
- rm -rf mongodb-database* #清理掉
- 导入测试数据
- wget http://media.mongodb.org/zips.json #这里使用亚马逊官方提供的
- mongoimport --host 127.0.0.1:27017 --db zips-db --file zips.json #使用mongoimport命令将数据导入新数据库zips-db


|-------|------|------|--------|-------|
| _id | city | loc | pop(万) | state |
| 数据ID号 | 城市名称 | 位置坐标 | 人数 | 所属哪个州 |