zoukankan      html  css  js  c++  java
  • 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:UsersAdministrator>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.

  • 相关阅读:
    OnSize() 与 OnInitDialog()[设置控件大小]
    C库函数中字符串处理函数集合
    智能提示导致Visual Studio 2010崩溃问题
    MFC中关闭窗口的几种方法
    8086寄存器组
    MASM6.1使用方法(适合初学者)
    MultiThread
    汇编语言超浓缩教程
    汇编 ADD与DAA指令
    Function Pointer
  • 原文地址:https://www.cnblogs.com/chucklu/p/6496309.html
Copyright © 2011-2022 走看看