MongoDB - The mongo Shell, Access the mongo Shell Help
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 method db.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 the mongo shell:
help misc
MongoDB - The mongo Shell, Access the mongo Shell Help的更多相关文章
- MongoDB - The mongo Shell, Configure the mongo Shell
Customize the Prompt You may modify the content of the prompt by setting the variable prompt in the ...
- MongoDB的安装,mongod和mongo的区别
一. mongoDB安装路径 安装路径(最新4.0.11):https://www.mongodb.com/download-center/community?jmp=nav 建议另外找路径下载,外网 ...
- MongoDB学习笔记:文档Crud Shell
MongoDB学习笔记:文档Crud Shell 文档插入 一.插入语法 db.collection.insertOne() 将单个文档插入到集合中.db.collection.insertMan ...
- MONGODB(三)——Java操作Mongo
相比于java调用MySqlApI来操作数据库,调用Mongo要简洁容易的多.通过一个简单的样例,很容易地就可以上手 一.导入Jar包 添加Monog支持Java的jar包,这里使用的是2.9.3 & ...
- 交互式shell和非交互式shell、登录shell和非登录shell的区别
交互式shell和非交互式shell.登录shell和非登录shell的区别.首先,这是两个不同的维度来划分的,一个是是否交互式,另一个是是否登录. 交互式shell和非交互式shell(intera ...
- linux中的shell脚本编程---初识shell
Shell是用户与Linux或Unix内核通信的工具,shell编程指的并不是编写这个工具,而是指利用现有的shell工具进行编程,写出来的程序是轻量级的脚本,我们叫做shell脚本. Shell的语 ...
- Ubuntu下把缺省的dash shell修改为bash shell
Ubuntu下缺省使用的是shell是dash,而不是bash.从/bin/sh软连接的指向可以看出这点. dash shell 虽然比bash shell更轻便,但是它并不支持所有的语法,运行she ...
- Shell编程-11-子Shell和Shell嵌套
目录 什么是子Shell 子Shell产生的途径 Shell脚本调用模式 什么是子Shell 子Shell的概念其实是贯穿整个Shell的,如果想要更好的理解和写Shell脚本则必须要了解子S ...
- [shell]shell 中| && || () {} 用法以及shell的逻辑与或非
转自:https://www.jianshu.com/p/617c1ee1e46e | 运算符 管道符号,是unix一个很强大的功能,符号为一条竖线:"|".用法: command ...
随机推荐
- 69道java Spring面试题和答案
http://www.jfox.info/69-dao-java-spring-mian-shi-ti-he-da-an 目录 Spring 概述 依赖注入 Spring beans Spring注解 ...
- VC++内存区域
转载声明:本文转载自http://blog.csdn.net/sjxbf/article/details/6441730 一.预备知识—程序的内存分配 一个由c/c++编译的程序占用的内存分为以下几个 ...
- ASP.NET中IsPostBack属性研究
通过页面的IsPostback属性,可以检查 .aspx 页是否为传递回服务器的页面:当加载页面并对控件的更改属性处理之前,用户可以在page_Load事件中检查该页面是否被传递回的页面. 一般是在p ...
- easy Html5 - Jquery Mobile之ToolBars(Header and Footer)
jquery 在web js框架上的风暴还在继续却也随着移动终端走向了mobile:那么jquery mobile到底包括些什么呢 简介工具栏是在移动网站和应用中的头部,尾部或者内容中的工具条:Jqu ...
- SAP MRP的计算步骤
SAP MRP的计算步骤,物料需求计划(简称为MRP)与主生产计划一样属于ERP计划管理体系,它主要解决企业生产中的物料需求与供给之间的关系,即无论是对独立需求的物料,还是相关需求的物料, ...
- 2013 US Open Award Ceremoney
http://v.youku.com/v_show/id_XNjA3MjU3MzY4.html?firsttime=0 Singapore how about another hand tr ...
- SIP入门(二):建立SIPserver
在我的上一篇文章中已经介绍怎样通过SIP软电话直接通话,可是假设须要支持很多其它用户互相通话,同一时候基于安全考虑,须要对用户帐户登录进行验证控制,这些情况下就须要建立SIPserver. SIPse ...
- [终极精简版][图解]Nginx搭建flv mp4流媒体服务器
花了我接近3周,历经了重重问题,今日终于把流媒体服务器搞定,赶紧的写个博文以免忘记... 起初是跟着网上的一些教程来的,但是说的很不全面,一些东西也过时不用了(比如jwplayer老版本).我这次是用 ...
- [Express] Level 1: First Step
Installing Express Let's start building our new Express application by installing Express. Type the ...
- 【Python】 做一个简单的 http server
# coding=utf-8 ''' Created on 2014年6月15日 @author: Yang ''' import socket import datetime # 初始化socket ...