总结:

1.使用help可以查看帮助信息db.help()  help等

2.查看对应的实现方法.比如

test@gzxkvm52$ db.updateUser
function (name, updateObject, writeConcern) {
var cmdObj = {updateUser: name};
cmdObj = Object.extend(cmdObj, updateObject);
cmdObj['writeConcern'] = writeConcern ? writeConcern : _defaultWriteConcern;
this._modifyCommandToDigestPasswordIfNecessary(cmdObj, name); var res = this.runCommand(cmdObj);
if (res.ok) {
return;
} if (res.errmsg == "no such cmd: updateUser") {
this._updateUserV1(name, updateObject, cmdObj['writeConcern']);
return;
} throw _getErrorWithCode(res, "Updating user failed: " + res.errmsg);
}

3 查看封装好的类的方法可以使用help xxx,比如BinData()这个方法,在misc类中,则help misc

test@gzxkvm52> help misc
b = new BinData(subtype,base64str) create a BSON BinData value
b.subtype() the BinData subtype (0..255)
b.length() length of the BinData data in bytes
b.hex() the data as a hex encoded string
b.base64() the data as a base 64 encoded string
b.toString() b = HexData(subtype,hexstr) create a BSON BinData value from a hex string
b = UUID(hexstr) create a BSON BinData value of UUID subtype
b = MD5(hexstr) create a BSON BinData value of MD5 subtype
"hexstr" string, sequence of hex characters (no 0x prefix) o = new ObjectId() create a new ObjectId
o.getTimestamp() return timestamp derived from first 32 bits of the OID
o.isObjectId
o.toString()
o.equals(otherid) d = ISODate() like Date() but behaves more intuitively when used
d = ISODate('YYYY-MM-DD hh:mm:ss') without an explicit "new " prefix on construction

In addition to the documentation in the MongoDB Manual, the mongo shell provides some additional information in its “online” help system. This document provides an overview of accessing this help information.

Command Line Help

To see the list of options and help for starting the mongo shell, use the --help option from the command line:

mongo --help

Shell Help

To see the list of help, in the mongo shell, type help:

help

Database Help

In the mongo shell:

  • To see the list of databases on the server, use the show dbs command:

    show dbs
    

    New in version 2.4: show databases is now an alias for show dbs

  • To see the list of help for methods you can use on the db object, call the db.help() method:

    db.help()
    
  • To see the implementation of a method in the shell, type the db.<method name> without the parenthesis (()), as in the following example which will return the implementation of the methoddb.updateUser():

    db.updateUser
    

Collection Help

In the mongo shell:

  • To see the list of collections in the current database, use the show collections command:

    show collections
    
  • To see the help for methods available on the collection objects (e.g. db.<collection>), use the db.<collection>.help() method:

    db.collection.help()
    

    <collection> can be the name of a collection that exists, although you may specify a collection that doesn’t exist.

  • To see the collection method implementation, type the db.<collection>.<method> name without the parenthesis (()), as in the following example which will return the implementation of the save()method:

    db.collection.save
    

Cursor Help

When you perform read operations with the find() method in the mongo shell, you can use various cursor methods to modify the find() behavior and various JavaScript methods to handle the cursor returned from the find() method.

  • To list the available modifier and cursor handling methods, use the db.collection.find().help()command:

    db.collection.find().help()
    

    <collection> can be the name of a collection that exists, although you may specify a collection that doesn’t exist.

  • To see the implementation of the cursor method, type the db.<collection>.find().<method>name without the parenthesis (()), as in the following example which will return the implementation of the toArray() method:

    db.collection.find().toArray
    

Some useful methods for handling cursors are:

  • hasNext() which checks whether the cursor has more documents to return.
  • next() which returns the next document and advances the cursor position forward by one.
  • forEach(<function>) which iterates the whole cursor and applies the <function> to each document returned by the cursor. The <function> expects a single argument which corresponds to the document from each iteration.

For examples on iterating a cursor and retrieving the documents from the cursor, see cursor handling. See also Cursor for all available cursor methods.

Wrapper Object Help

To get a list of the wrapper classes available in the mongo shell, such as BinData(), type help misc in themongo shell:

help misc

2.Access the mongo Shell Help-官方文档摘录的更多相关文章

  1. Cocos Creator 加载和切换场景(官方文档摘录)

    Cocos Creator 加载和切换场景(官方文档摘录) 在 Cocos Creator 中,我们使用场景文件名( 可以不包含扩展名)来索引指代场景.并通过以下接口进行加载和切换操作: cc.dir ...

  2. ng的概念层次(官方文档摘录)

    官方文档是这么说的: You write Angular applications by: composing HTML templates with Angularized markup, writ ...

  3. Cocos Creator 生命周期回调(官方文档摘录)

    Cocos Creator 为组件脚本提供了生命周期的回调函数.用户通过定义特定的函数回调在特定的时期编写相关 脚本.目前提供给用户的声明周期回调函数有: onLoad start update la ...

  4. Cocos Creator 使用计时器(官方文档摘录)

    在 Cocos Creator 中,我们为组件提供了方便的计时器,这个计时器源自于 Cocos2d-x 中的 cc.Scheduler,我们将它保留在了 Cocos Creator 中并适配了基于组件 ...

  5. angular 模板语法(官方文档摘录)

    https://angular.cn/guide/template-syntax {{}} 和"" 如果嵌套,{{}}里面求完值,""就是原意 <h3&g ...

  6. Spring Cloud官方文档中文版-Spring Cloud Config(上)

    官方文档地址为:http://cloud.spring.io/spring-cloud-static/Dalston.SR2/#spring-cloud-feign 文中例子我做了一些测试在:http ...

  7. Spring Data Commons 官方文档学习

    Spring Data Commons 官方文档学习   -by LarryZeal Version 1.12.6.Release, 2017-07-27 为知笔记版本在这里,带格式. Table o ...

  8. 【翻译】Django Channels 官方文档 -- Tutorial

    Django Channels 官方文档 https://channels.readthedocs.io/en/latest/index.html 前言: 最近课程设计需要用到 WebSocket,而 ...

  9. hbase官方文档(转)

    FROM:http://www.just4e.com/hbase.html Apache HBase™ 参考指南  HBase 官方文档中文版 Copyright © 2012 Apache Soft ...

  10. HBase 官方文档

    HBase 官方文档 Copyright © 2010 Apache Software Foundation, 盛大游戏-数据仓库团队-颜开(译) Revision History Revision ...

随机推荐

  1. zookeeper程序员指南

    1 简介本文是为想要创建使用ZooKeeper协调服务优势的分布式应用的开发者准备的.本文包含理论信息和实践信息.本指南的前四节对各种ZooKeeper概念进行较高层次的讨论.这些概念对于理解ZooK ...

  2. QT界面 理解QStyle和QStyleOption以及QStyleFactory

    QStyleOption类和QStyle类简介 QStyleOption类存储QStyle函数使用的参数.QStyleOption及其子类包含了QStyle函数绘制图形元素所需的所有信息. 由于性能原 ...

  3. 有了 tldr,妈妈再也不用担心我记不住命令了

    引言 有一次我在培训时说「程序员要善于使用 Terminal 以提高开发效率」,一位程序员反驳道:「这是 21 世纪,我们为什么要用落后的命令行,而不是先进的 GUI?」 是的,在一些人眼里,这个黑黑 ...

  4. Java 调用 C/C++ 之 JNA 系列实战篇 —— 输出char * (六)

    一. 工作环境 1. windows (64位), JDK (64位),dll文件 (64位) 2. Linux (64位),      JDK (64位),so文件 (64位) 3. JNA的官方资 ...

  5. Hive分析窗体函数之SUM,AVG,MIN和MAX

    行 AVG(pnum) OVER(PARTITION BYpolno ORDER BY createtime ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOW ...

  6. Hive学习笔记——基本配置及测试

    1.什么是Hive Hive 是建立在 Hadoop上的数据仓库基础构架.它提供了一系列的工具,可以用来进行数据提取转化加载(ETL),这是一种可以存储.查询和分析存储在Hadoop中的大规模数据的机 ...

  7. 爬虫 (6)- Scrapy 实战案例 - 爬取不锈钢的相关钢卷信息

    超详细创建流程及思路 一. 新建项目 1.创建文件夹,然后在对应文件夹创建一个新的python项目 2.点击Terminal命令行窗口,运行下面的命令创建scrapy项目 scrapy startpr ...

  8. 如何使用 PsExec 执行远程命令

    前言 这紧紧只是一篇纯技术分享.我们的程序在运行时需要连接多台目标机器,并拷贝目标机器上特定文件夹中的文件.为了方便访问,要在每台目标机器上建立一个特定用户,所以 PsExec 成了实现此功能的一个方 ...

  9. 第二百零四节,jQuery EasyUI,Dialog(对话框)组件

    jQuery EasyUI,Dialog(对话框)组件 学习要点: 1.加载方式 2.属性列表 3.事件列表 4.方法列表 本节课重点了解EasyUI中Dialog(窗口)组件的使用方法,这个组件依赖 ...

  10. 搭建一个SSM框架

    刚好学完springMVC,mybatis简单的组合,总结一下 1.创建一个maven项目,引入jar包 一共这么多,除了oracle jar包是我手动添加到lib里,其他都是通过pom.xml引入的 ...