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 Shell (mongo)的更多相关文章
- Getting Started with MongoDB (MongoDB Shell Edition)
https://docs.mongodb.com/getting-started/shell/ Overview Welcome to the Getting Started with MongoDB ...
- MongoDB error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js(转)
rror: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js 一般这种情况就是:自己指定的数据库,所以不能.自动加 ...
- MongoDB入门三:MongoDB shell
MongoDB shell MongDB shell是一个功能完备的Javascript解释器,可以运行Javascript程序.也可以用于连接MongoDB服务器,执行脚本,对数据库进行操作.类似于 ...
- MongoDB Shell
MongoDB Shell 1.连接指定主机及数据库 mongo 127.0.0.1:30000/myDB 链接到127.0.0.1的30000端口的myDB 2.启动后连接指定数据库 *.&qu ...
- MongoDB 学习笔记(二)—— MongoDB Shell
MongoDB自带一个JavaScript shell 可以从命令行中与MongoDB交互,功能非常强大.如在上一节最后一张图所看到,可以执行JavaScript程序. 运行Shell 前提是启动Mo ...
- [转载]MongoDB学习(三):MongoDB Shell的使用
MongoDB shell MongoDB自带简洁但功能强大的JavaScript shell.JavaScript shell键入一个变量会将变量的值转换为字符串打印到控制台上. 下面介绍基本的操作 ...
- [MongoDB] - Shell基本命令
在这里,我简单的记录一下MongoDB在shell客户端中使用的基本命令,比如创建/显示数据库,创建集合,删除集合等. 一.启动MongoDB并连接shell客户端 使用mongod.exe和mong ...
- 【mongodb系统学习之八】mongodb shell常用操作
八.mongodb shell常用基础操作(每个语句后可以加分号,也可以不加,看情况定(有的工具中可以不加),最好是加): 1).进入shell操作界面:mongo,上边已有演示: 2).查看当前使 ...
- 【mongodb系统学习之三】进入mongodb shell
三. 进入mongodb shell(数据库操作界面) : 1).在mongodb的bin目录下输入./mongo,默认连接test数据库,连接成功会显示数据库版本和当前连接的数据库名,如图: 2). ...
随机推荐
- PatentTips – Java native function calling
BACKGROUND OF INVENTION This invention relates to a system and method for providing a native functio ...
- angular-表格
ng-repeat 指令可以完美的显示表格. <div ng-app="myApp" ng-controller="customersCtrl"> ...
- Android BLE与终端通信(三)——client与服务端通信过程以及实现数据通信
Android BLE与终端通信(三)--client与服务端通信过程以及实现数据通信 前面的终究仅仅是小知识点.上不了台面,也仅仅能算是起到一个科普的作用.而同步到实际的开发上去,今天就来延续前两篇 ...
- 高速排序算法C++实现
//quick sort //STL中也有现成的高速排序算法.内部实现採用了下面技巧 //1)枢轴的选择採取三数取中的方式 //2)后半段採取循环的方式实现 //3)高速排序与插入排序结合 #incl ...
- 禁掉Apache web server签名 How to turn off server signature on Apache web server
有的时候,我们为了从安全角度考虑,防止黑客恶意攻击.我们会隐藏掉server信息,比方,一般我们会发现例如以下信息. 我用的是centos (fedora, RHEL也一样) $ sudo vi /e ...
- 黑马day15 文件上传&apche的工具包
1.肯定要导入apche的jar包 2.要使用的类的介绍.. 2.1DiskFileItemFactory public DiskFileItemFactory(int sizeThreshold, ...
- C/S和B/S交互
近期一直在做C/S的项目,每天都超忙,抽个时间写篇博客,之前一直做C/S项目就是各种窗口.各种控件,拖来拖去,然后点进去写方法,做BS的时候呢,由于一直使用的是mvc,所以就是常常手写代码.或者拖引用 ...
- P3369 【模板】普通平衡树(Treap/SBT)(pb_ds版)
题目描述 您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作: 插入x数 删除x数(若有多个相同的数,因只删除一个) 查询x数的排名(若有多个相同的数,因输出最小的排名) 查询 ...
- MSSQL读取xml字符串到临时表
DECLARE @hdoc int DECLARE @doc xml SET @doc ='<CityValueSet> <CityItem> <CityId>20 ...
- 【原创】java中各种集合类的实现浅析
[LinkedList] LinkedList使用了链表来实现List功能,而且是双向循环链表,它的Entry定义如下: private static class Entry<E> { / ...