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. NYIST 860 又见01背包

    又见01背包时间限制:1000 ms | 内存限制:65535 KB难度:3 描述 有n个重量和价值分别为wi 和 vi 的 物品,从这些物品中选择总重量不超过 W 的物品,求所有挑选方案中物品价值总 ...

  2. 阅读《Android 从入门到精通》(15)——数字时钟

    数字时钟(DigitalClock) java.lang.Object; android.view.View; android.widget.TextView; android.widget.Digi ...

  3. Perl怎样过滤html标签

    比方一串字符串 <div><b>123</b></div> 假设仅仅想拿到123怎么办呢? 用perl的正則表達式能够非常easy的做到. $str = ...

  4. apiCloud实现加载更多效果,基本完美~

    apiCloud实现加载更多效果 1.接口支持,加入参数page. $page = $this->_request('page','trim','1'); $pagesize = 10; // ...

  5. java中去掉html标签

    import java.util.regex.Matcher; import java.util.regex.Pattern; public class HTMLSpirit{     public ...

  6. (六)api网关服务 zuul-过滤器

    开启上文服务: Zuul给我们的第一印象通常是这样:它包含了对请求的路由和过滤两个功能,其中路由功能负责将外部请求转发到具体的微服务实例上,是实现外部访问统一入口的基础.过滤器功能则负责对请求的处理过 ...

  7. html5+css3+javascript 自定义提示窗口

    效果图: 源码: 1.demo.jsp <%@ page contentType="text/html;charset=UTF-8" language="java& ...

  8. PHP正则表达式函数总结

    /* 测试环境:PHP5.3.29(PCRE8.32) */ 常用函数:(正则表达式规则基本同JS_RE_Read.txt) PS:1.PHP中的PCRE一般仅使用这三个修饰符:"i&quo ...

  9. Hibernate框架学习(一)——入门

    一.框架是什么 1.框架是用来提高开发效率的 2.封装好了一些功能,我们需要使用这些功能时,调用即可,不需要手动实现 3.框架可以理解成一个半成品的项目,只要懂得如何驾驭这些功能即可 二.hibern ...

  10. POJ 2481 Cows【树状数组】

    题意:给出n头牛的s,e 如果有两头牛,现在si <= sj && ei >= ej 那么称牛i比牛j强壮 然后问每头牛都有几头牛比它强壮 先按照s从小到大排序,然后用e来 ...