先從幫助命令入手,看能做哪些事情。
db.help() help on db methods
db.mycoll.help() help on collection methods
sh.help() sharding helpers
rs.help() replica set helpers
help admin administrative help
help connect connecting to a db help
help keys key shortcuts
help misc misc things to know
help mr mapreduce
show dbs show database names
show collections show collections in current database
show users show users in current database
show profile show most recent system.profile entries with time >= 1ms
show logs show the accessible logger names
show log [name] prints out the last segment of log in memory, 'global' is default
use <db_name> set current database
db.foo.find() list objects in collection foo
db.foo.find( { a : 1 } ) list objects in foo where a == 1
it result of the last line evaluated; use to further iterate
DBQuery.shellBatchSize = x set default number of items to display on shell
exit quit the mongo shell
db.help()
和 db.mycoll.help()
從字面意思很容易看出是數(shù)據(jù)庫 (database慧瘤,類似關系型數(shù)據(jù)庫的庫) 和里面集合 (collection,類似關系型數(shù)據(jù)庫的表),這兩個命令內(nèi)容非常多艇拍,是一系列核心操作。
sh.help()
:google 一番:
Sharding is a type of database partitioning that separates very large databases the into smaller, faster, more easily managed parts called data shards. The word shard means a small part of a whole.
大概是數(shù)據(jù)庫體積變得非常大的時候的優(yōu)化手段宠纯。
rs.help()
:mongodb 官網(wǎng)是這樣介紹的:
A replica set in MongoDB is a group of mongod processes that maintain the same data set. Replica sets provide redundancy and high availability, and are the basis for all production deployments.
類似 mysql 的主從數(shù)據(jù)庫概念卸夕。
help admin
:一些操作文件,診斷信息的命令婆瓜。
help connect
:如何連接到 mongodb快集。
help keys
:shell 可用的快捷鍵。
help misc
:
To get a list of the wrapper classes available in the mongo shell, such as BinData(), type help misc in the mongo shell
可以通過這個命令查詢數(shù)據(jù)被 BinData()
包裹之后可以執(zhí)行的方法廉白。
help mr
:
Map-reduce is a data processing paradigm for condensing large volumes of data into useful aggregated results. For map-reduce operations, MongoDB provides the mapReduce database command.
將巨大的數(shù)據(jù)匯總成直觀的結(jié)果个初。
剩下的都是一些比較簡單的查詢命令和其它命令。