MongoDB Shell (mongo)
https://docs.mongodb.com/getting-started/shell/client/
The mongo shell is an interactive JavaScript interface to MongoDB and is a component of the MongoDB package.
You can use the mongo shell to query and update data as well as perform administrative operations.
Start mongo
Once you have installed and have started MongoDB, connect the mongo shell to your running MongoDB instance.
Ensure that MongoDB is running before attempting to launch the mongo shell.
On the same system where the MongoDB is running, open a terminal window (or a command prompt for Windows) and run the mongo shell with the following command:
mongo
On Windows systems, add .exe as follows:
mongo.exe
You may need to specify the path as appropriate. //如果配置到环境变量的话,可以直接mongo
When you run mongo without any arguments, the mongo shell will attempt to connect to the MongoDB instance running on the localhost interface on port 27017.
To specify a different host or port number, as well as other options, see mongo Shell Reference Page.
mongo --host localhost --port 27017
mongo --host 192.168.1.18 --port 27017
C:\Users\Administrator>mongo --host 192.168.1.63 --port 10001
MongoDB shell version v3.4.2
connecting to: mongodb://192.168.1.63:10001/
MongoDB server version: 3.4.2
Server has startup warnings:
2017-03-02T17:36:14.784+0800 I CONTROL [initandlisten]
2017-03-02T17:36:14.784+0800 I CONTROL [initandlisten] ** WARNING: Access contr
ol is not enabled for the database.
2017-03-02T17:36:14.785+0800 I CONTROL [initandlisten] ** Read and wri
te access to data and configuration is unrestricted.
2017-03-02T17:36:14.785+0800 I CONTROL [initandlisten]
2017-03-02T17:36:14.785+0800 I CONTROL [initandlisten] Hotfix KB2731284 or late
r update is not installed, will zero-out data files.
2017-03-02T17:36:14.785+0800 I CONTROL [initandlisten]
Help in mongo Shell
Type help in the mongo shell for a list of available commands and their descriptions:
help
The mongo shell also provides <tab> key completion as well as keyboard shortcuts similar to those found in the bash shell or in Emacs.
For example, you can use the <up-arrow> and the <down-arrow> to retrieve operations from its history.
Additional Information
See the following documents in the MongoDB Manual for more information on the mongo shell.
- Shell Quick Reference for more information.
- MongoDB Shell Help
- mongo Reference Page
- mongo Shell Scripting
- Data Types in the MongoDB Shell
相关文章
- mongoDB Robo 3T 执行命令行shell
- MongoDB学习笔记:文档Crud Shell
- 【mongodb系统学习之三】进入mongodb shell
- 【Mongodb】 replica set 添加和删除节点。
- MongoDB资料汇总(转)
- Linux Shell脚本自动化编程实战- shell函数
- scrapy把数据保存到mongodb
- [MongoDB] Mongo 表字段添加索引, 查看索引, 删除索引
- [MongoDB] Mongodb攻略
- 不使用spring的情况下用java原生代码操作mongodb数据库的两种方式
- 已解决(MongoDB安装报错)Service ‘MongoDB Server (MongoDB)’ (MongoDB) failed tostart. Verify that you have su
- Linux centos7连接mongodb错误 查看和关闭防火墙
- 学习Spring Boot:(二十)使用 MongoDB
- MongoDB基本文件操作
- [手游项目3]-21-MongoDB的安装和使用
- Node.js使用mongodb.js操作MongoDB数据库
- 【MongoDB】The Access control of mongodb
- [shell]Shell经常使用特殊符号
- java对mongodb的and, in, or 经常使用操作
- 20.第六章 Shell脚本编程基础入门 -- shell 脚本语言的基本用法(三)
- 19.第六章 Shell脚本编程基础入门 -- shell 脚本语言的基本用法(二)
- MongoDB(八)Mongodb——GridFS存储
- MongoDB之shard_副本集和分片部署
- MongoDB技术全系列
- MongoDB(3)-MongoDB常用的高级查询
- shell - 01 - Shell入门:扎好马步 走的更稳