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.

MongoDB Shell (mongo)的更多相关文章

  1. Getting Started with MongoDB (MongoDB Shell Edition)

    https://docs.mongodb.com/getting-started/shell/ Overview Welcome to the Getting Started with MongoDB ...

  2. 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 一般这种情况就是:自己指定的数据库,所以不能.自动加 ...

  3. MongoDB入门三:MongoDB shell

    MongoDB shell MongDB shell是一个功能完备的Javascript解释器,可以运行Javascript程序.也可以用于连接MongoDB服务器,执行脚本,对数据库进行操作.类似于 ...

  4. MongoDB Shell

    MongoDB Shell   1.连接指定主机及数据库 mongo 127.0.0.1:30000/myDB 链接到127.0.0.1的30000端口的myDB 2.启动后连接指定数据库 *.&qu ...

  5. MongoDB 学习笔记(二)—— MongoDB Shell

    MongoDB自带一个JavaScript shell 可以从命令行中与MongoDB交互,功能非常强大.如在上一节最后一张图所看到,可以执行JavaScript程序. 运行Shell 前提是启动Mo ...

  6. [转载]MongoDB学习(三):MongoDB Shell的使用

    MongoDB shell MongoDB自带简洁但功能强大的JavaScript shell.JavaScript shell键入一个变量会将变量的值转换为字符串打印到控制台上. 下面介绍基本的操作 ...

  7. [MongoDB] - Shell基本命令

    在这里,我简单的记录一下MongoDB在shell客户端中使用的基本命令,比如创建/显示数据库,创建集合,删除集合等. 一.启动MongoDB并连接shell客户端 使用mongod.exe和mong ...

  8. 【mongodb系统学习之八】mongodb shell常用操作

    八.mongodb  shell常用基础操作(每个语句后可以加分号,也可以不加,看情况定(有的工具中可以不加),最好是加): 1).进入shell操作界面:mongo,上边已有演示: 2).查看当前使 ...

  9. 【mongodb系统学习之三】进入mongodb shell

    三. 进入mongodb shell(数据库操作界面) : 1).在mongodb的bin目录下输入./mongo,默认连接test数据库,连接成功会显示数据库版本和当前连接的数据库名,如图: 2). ...

随机推荐

  1. 2015 Multi-University Training Contest 5 hdu 5349 MZL's simple problem

    MZL's simple problem Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Oth ...

  2. 洛谷 P2932 [USACO09JAN]地震造成的破坏Earthquake Damage

    P2932 [USACO09JAN]地震造成的破坏Earthquake Damage 题目描述 Wisconsin has had an earthquake that has struck Farm ...

  3. 关于android的设备管理器-DevicePolicyManager(一)

    在Andorid的设置->安全里面有个设备管理器的选项,相信大部分android用户都不太会去注意这个东西.近期在安装了一个应用之后发现这个里面的东西变了.怎么回事呢,研究研究看看.</s ...

  4. VC6.0VB6.0 Scratch等软件

    VC6.0VB6.0 Scratch等软件 http://pan.baidu.com/s/1nv4hJrb

  5. IOS假设将一个十六进制的color转换成UIColor,非常有用

    UI给开发的效果图非常多时候标注着十六进制的Color,而程序中用到的往往是UIColor能够用例如以下方法去转换: (UIColor *)RGBColorFromHexString:(NSStrin ...

  6. Double 与 Float 的值的比較结果

    首先看geeksforgeeks上的两个程序: 程序1: #include<stdio.h> int main() { float x = 0.1; if (x == 0.1) print ...

  7. Math类概述及其成员方法

    Math 类包括用于运行基本数学运算的方法,如初等指数.对数.平方根和三角函数,这个类寻常开发中用的不多,可是在某些需求上会用到,比方求二个用户年龄的相差多少岁,这会用到Math类中的方法!如今把Ma ...

  8. 千万别相信鲁大师的硬件測温柔CPU測温功能!!

    非常多人本来随手安装的一个软件. 相信也信任得过它 . 这下让我測试对它失望了.没想到鲁大师这个測温功能实在太搓了!! 白白浪费了我一晚上,  搞来了硅胶 ,弄了几遍  , 还是一样, 还以为买了水货 ...

  9. Oracle 11g AWR生成报告

    1.生成单实例 AWR 报告: @$ORACLE_HOME/rdbms/admin/awrrpt.sql 2.生成 Oracle RAC AWR 报告: @$ORACLE_HOME/rdbms/adm ...

  10. jquery获取焦点和失去焦点

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...