MongoDB Manual Contents
ΒΆ
Install MongoDB
Install MongoDB on Red Hat Enterprise, CentOS, or Fedora Linux
Install MongoDB on Ubuntu
Install MongoDB on Debian
Install MongoDB on Linux
Install MongoDB on OS X
Install MongoDB on Windows
Install MongoDB Enterprise
Administration
Run-time Database Configuration
Backup and Recovery Operations for MongoDB
Use
mongodump
and
mongorestore
to Backup and Restore MongoDB Databases
Use Filesystem Snapshots to Backup and Restore MongoDB Databases
Copy Databases Between Instances
Recover MongoDB Data following Unexpected Shutdown
Backup a Small Sharded Cluster with
mongodump
Create Backup of a Sharded Cluster with Filesystem Snapshots
Create Backup of a Sharded Cluster with Database Dumps
Restore a Single Shard
Restore Sharded Clusters
Schedule Backup Window for Sharded Clusters
Data Center Awareness
Operational Segregation in MongoDB Operations and Deployments
Tag Aware Sharding
Administer and Manage Shard Tags
Deploy a Geographically Distributed Replica Set
Journaling
Connect to MongoDB with SSL
Monitor MongoDB with SNMP
Manage
mongod
Processes
Rotate Log Files
Monitoring for MongoDB
Analyze Performance of Database Operations
Import and Export MongoDB Data
Linux
ulimit
Settings
Production Notes
Use Database Commands
MongoDB Tutorials
Security
Security Practices and Management
Access Control
Configure Linux
iptables
Firewall for MongoDB
Configure Windows
netsh
Firewall for MongoDB
Create a Vulnerability Report
Enable Authentication
Create a User Administrator
Add a User to a Database
Generate a Key File
Deploy MongoDB with Kerberos Authentication
User Privilege Roles in MongoDB
system.users
Privilege Documents
Password Hashing Insecurity
Core MongoDB Operations (CRUD)
Read Operations
Write Operations
Write Concern Reference
BSON Documents
ObjectId
GridFS
Database References
Create
Read
Update
Delete
Data Modeling
Data Modeling Considerations for MongoDB Applications
Model Embedded One-to-One Relationships Between Documents
Model Embedded One-to-Many Relationships Between Documents
Model Referenced One-to-Many Relationships Between Documents
Model Data for Atomic Operations
Model Tree Structures with Parent References
Model Tree Structures with Child References
Model Tree Structures with an Array of Ancestors
Model Tree Structures with Materialized Paths
Model Tree Structures with Nested Sets
Model Data to Support Keyword Search
Aggregation
Aggregation Framework
Aggregation Framework Examples
Aggregation Framework Reference
SQL to Aggregation Framework Mapping Chart
Map-Reduce
Map-Reduce Examples
Perform Incremental Map-Reduce
Troubleshoot the Map Function
Troubleshoot the Reduce Function
Simple Aggregation Methods and Commands
Indexes
Indexing Overview
Indexing Strategies
Create Indexes to Support Your Queries
Use Indexes to Sort Query Results
Ensure Indexes Fit RAM
Create Queries that Ensure Selectivity
Indexing Operations
Create an Index
Create a Compound Index
Create a Unique Index
Create a Sparse Index
Create a Hashed Index
Build Indexes on Replica Sets
Build Indexes in the Background
Remove Indexes
Rebuild Indexes
Monitor and Manage In Progress Index Creation and Building
Return a List of All Indexes
Measure Index Use
Build Old Style Indexes
Geospatial Indexes and Queries
2d
Indexes
2dsphere
Indexes
Haystack Indexes
Calculate Distances in a
2d
Index Using Spherical Geometry
2d
Index Internals
Text Search
Create
text
Index on Multiple Fields
Specify a Language for Text Index
Specify
text
Index Name to Avoid Name Length Limit
Create a
text
Index on a Multi-language Collection
Control Results of Text Search with Weights
Limit the Number of Index Entries Scanned for Text Search
Return Text Queries Using Only a
text
Index
Replication
Replica Set Fundamental Concepts
Replica Set Architectures and Deployment Patterns
Replica Set Considerations and Behaviors for Applications and Development
Write Concern
Read Preference
Replica Set Internals and Behaviors
Master Slave Replication
Replica Set Administration
Deploy a Replica Set
Convert a Standalone to a Replica Set
Add Members to a Replica Set
Remove Members from Replica Set
Replace a Replica Set Member
Adjust Priority for Replica Set Member
Resync a Member of a Replica Set
Deploy a Geographically Distributed Replica Set
Change the Size of the Oplog
Force a Member to Become Primary
Manage Chained Replication
Change Hostnames in a Replica Set
Troubleshoot Replica Sets
Add an Arbiter to Replica Set
Convert a Secondary to an Arbiter
Configure a Delayed Replica Set Member
Configure a Replica Set Member as Hidden
Configure a Non-Voting Replica Set Member
Prevent Replica Set Member from Becoming Primary
Configure a Secondary’s Sync Target
Configure Replica Set Tag Sets
Reconfigure a Replica Set with Unavailable Members
Replica Set Configuration
Replica Set Commands
Replica Set Features and Version Compatibility
Sharding
Sharded Cluster Overview
Sharded Cluster Architectures
Query Routing in Sharded Clusters
Security Practices for Sharded Clusters
Sharded Cluster Internals
Sharded Cluster Administration
Deploy a Sharded Cluster
Select a Shard Key
Hashed Sharding
Enable Authentication in a Sharded Cluster
View Cluster Configuration
Add Shards to a Cluster
Convert a Replica Set to a Replicated Sharded Cluster
Administer and Manage Shard Tags
Deploy Three Config Servers for Production Deployments
Migrate Config Servers with the Same Hostname
Migrate Config Servers with Different Hostnames
Replace a Config Server
Backup Cluster Metadata
Manage Chunks in a Sharded Cluster
Configure Behavior of Balancer Process in Sharded Clusters
Manage Sharded Cluster Balancer
Remove Shards from an Existing Sharded Cluster
Tag Aware Sharding
Enforce Unique Keys for Sharded Collections
Shard GridFS Data Store
Application Development
MongoDB Drivers and Client Libraries
Optimization Strategies for MongoDB
Optimize Query Performance with Indexes and Projections
Evaluate Performance of Current Operations
Use Capped Collections for Fast Writes and Reads
Capped Collections
Server-side JavaScript
Store a JavaScript Function on the Server
Perform Two Phase Commits
Create Tailable Cursor
Isolate Sequence of Operations
Create an Auto-Incrementing Sequence Field
Limit Number of Elements in an Array after an Update
Expire Data from Collections by Setting TTL
The
mongo
Shell
Getting Started with the
mongo
Shell
Data Types in the
mongo
Shell
Access the
mongo
Shell Help Information
Write Scripts for the
mongo
Shell
mongo
Shell Quick Reference
Use Cases
Storing Log Data
Pre-Aggregated Reports
Hierarchical Aggregation
Product Catalog
Inventory Management
Category Hierarchy
Metadata and Asset Management
Storing Comments
Write a Tumblelog Application with Django MongoDB Engine
Write a Tumblelog Application with Flask and MongoEngine
Frequently Asked Questions
FAQ: MongoDB Fundamentals
FAQ: MongoDB for Application Developers
FAQ: The
mongo
Shell
FAQ: Concurrency
FAQ: Sharding with MongoDB
FAQ: Replica Sets and Replication in MongoDB
FAQ: MongoDB Storage
FAQ: Indexes
FAQ: MongoDB Diagnostics
Reference
Query, Update and Projection Operators
Comparison Query Operators
$all
$gt
$gte
$in
$lt
$lte
$ne
$nin
Logical Query Operators
$or
$and
$not
$nor
Element Query Operators
$exists
$mod
$type
JavaScript Query Operators
$where
$regex
Geospatial Query Operators
$geoWithin
$geoIntersects
$near
$nearSphere
Query Operator Array
$elemMatch (query)
$size
Field Update Operators
$inc
$rename
$setOnInsert
$set
$unset
Array Update Operators
$ (query)
$addToSet
$pop
$pullAll
$pull
$pushAll
$push
$each
$slice
$sort
Bitwise Update Operator
$bit
Isolation Update Operator
$isolated
Projection Operators
$ (projection)
$elemMatch (projection)
$slice (projection)
Meta Query Operator Quick Reference
$comment
$explain
$hint
$maxScan
$max
$min
$orderby
$returnKey
$showDiskLoc
$snapshot
$natural
Database Commands
Aggregation Commands
aggregate
count
distinct
group
mapReduce
Geospatial Commands
geoNear
geoSearch
geoWalk
Query and Write Operation Commands
findAndModify
text
getLastError
getPrevError
resetError
eval
Replication Commands
replSetFreeze
replSetGetStatus
replSetInitiate
replSetMaintenance
replSetReconfig
replSetStepDown
replSetSyncFrom
resync
applyOps
isMaster
getoptime
Sharding Commands
flushRouterConfig
addShard
checkShardingIndex
enableSharding
listShards
removeShard
getShardMap
getShardVersion
setShardVersion
shardCollection
shardingState
unsetSharding
split
splitChunk
splitVector
medianKey
moveChunk
movePrimary
isdbgrid
Administration Commands
renameCollection
copydb
dropDatabase
drop
create
clone
cloneCollection
cloneCollectionAsCapped
closeAllDatabases
convertToCapped
filemd5
dropIndexes
fsync
clean
connPoolSync
compact
collMod
reIndex
setParameter
getParameter
repairDatabase
touch
shutdown
logRotate
Diagnostic Commands
listDatabases
dbHash
driverOIDTest
listCommands
availableQueryOptions
buildInfo
collStats
connPoolStats
dbStats
cursorInfo
dataSize
diagLogging
getCmdLineOpts
netstat
ping
profile
validate
top
indexStats
whatsmyuri
getLog
hostInfo
serverStatus
features
isSelf
Internal Commands
handshake
recvChunkAbort
recvChunkCommit
recvChunkStart
recvChunkStatus
replSetFresh
mapreduce.shardedfinish
transferMods
replSetHeartbeat
replSetGetRBID
migrateClone
replSetElect
writeBacksQueued
writebacklisten
Testing Commands
testDistLockWithSkew
testDistLockWithSyncCluster
captrunc
emptycapped
godinsert
_hashBSONElement
journalLatencyTest
sleep
replSetTest
forceerror
skewClockCommand
configureFailPoint
mongo
Shell Methods
Collection Methods
db.collection.aggregate()
db.collection.count()
db.collection.createIndex()
db.collection.getIndexStats()
db.collection.dataSize()
db.collection.distinct()
db.collection.drop()
db.collection.dropIndexes()
db.collection.dropIndexes()
db.collection.ensureIndex()
db.collection.find()
db.collection.findAndModify()
db.collection.findOne()
db.collection.getIndexes()
db.collection.getShardDistribution()
db.collection.getShardVersion()
db.collection.group()
db.collection.insert()
db.collection.isCapped()
db.collection.mapReduce()
db.collection.reIndex()
db.collection.remove()
db.collection.renameCollection()
db.collection.save()
db.collection.stats()
db.collection.storageSize()
db.collection.totalSize()
db.collection.storageSize()
db.collection.update()
db.collection.validate()
Cursor Methods
cursor.addOption()
cursor.batchSize()
cursor.count()
cursor.explain()
cursor.forEach()
cursor.hasNext()
cursor.hint()
cursor.limit()
cursor.map()
cursor.max()
cursor.min()
cursor.next()
cursor.objsLeftInBatch()
cursor.readPref()
cursor.showDiskLoc()
cursor.size()
cursor.skip()
cursor.snapshot()
cursor.sort()
cursor.toArray()
Database Methods
db.addUser()
db.auth()
db.cloneCollection()
db.cloneDatabase()
db.commandHelp()
db.copyDatabase()
db.createCollection()
db.currentOp()
db.dropDatabase()
db.eval()
db.fsyncLock()
db.fsyncUnlock()
db.getCollection()
db.getCollectionNames()
db.getLastError()
db.getLastErrorObj()
db.getMongo()
db.getName()
db.getPrevError()
db.getProfilingLevel()
db.getProfilingStatus()
db.getReplicationInfo()
db.getSiblingDB()
db.help()
db.hostInfo()
db.isMaster()
db.killOp()
db.listCommands()
db.loadServerScripts()
db.logout()
db.printCollectionStats()
db.printReplicationInfo()
db.printShardingStatus()
db.printSlaveReplicationInfo()
db.removeUser()
db.repairDatabase()
db.resetError()
db.runCommand()
db.serverBuildInfo()
db.serverStatus()
db.setProfilingLevel()
db.shutdownServer()
db.stats()
db.version()
Replication Methods
rs.add()
rs.addArb()
rs.conf()
rs.freeze()
rs.help()
rs.initiate()
rs.reconfig()
rs.remove()
rs.slaveOk()
rs.status()
rs.stepDown()
rs.syncFrom()
Sharding Methods
sh._adminCommand()
sh._checkFullName()
sh._checkMongos()
sh._lastMigration()
sh.addShard()
sh.addShardTag()
sh.addShardTag()
sh.disableBalancing()
sh.enableBalancing()
sh.enableSharding()
sh.getBalancerHost()
sh.getBalancerState()
sh.help()
sh.isBalancerRunning()
sh.moveChunk()
sh.removeShardTag()
sh.setBalancerState()
sh.shardCollection()
sh.splitAt()
sh.splitFind()
sh.startBalancer()
sh.status()
sh.stopBalancer()
sh.waitForBalancer()
sh.waitForBalancerOff()
sh.waitForDLock()
sh.waitForPingChange()
Connection Methods
Mongo.getDB()
Mongo.getReadPrefMode()
Mongo.getReadPrefTagSet()
Mongo.setReadPref()
mongo.setSlaveOk()
Mongo()
connect()
Subprocess Methods
clearRawMongoProgramOutput()
rawMongoProgramOutput()
run()
runMongoProgram()
runProgram()
startMongoProgram()
stopMongoProgram()
stopMongoProgramByPid()
stopMongod()
waitMongoProgramOnPort()
waitProgram()
Native Methods
cat()
cd()
copyDbpath()
resetDbpath()
fuzzFile()
getHostName()
getMemInfo()
hostname()
_isWindows()
listFiles()
load()
ls()
md5sumFile()
mkdir()
pwd()
quit()
rand()
removeFile()
_srand()
SQL to MongoDB Mapping Chart
MongoDB Package Components
mongod
mongos
mongo
mongod.exe
mongos.exe
mongodump
mongorestore
bsondump
mongooplog
mongoimport
mongoexport
mongostat
mongotop
mongosniff
mongoperf
mongofiles
Configuration File Options
mongod
Parameters
The
local
Database
System Collections
Database Profiler Output
Exit Codes and Statuses
MongoDB Limits and Thresholds
Connection String URI Format
MongoDB Extended JSON
Database References
GridFS Reference
Glossary
Release Notes
Release Notes for MongoDB 2.4
Release Notes for MongoDB 2.2
Release Notes for MongoDB 2.0
Release Notes for MongoDB 1.8
Release Notes for MongoDB 1.6
Release Notes for MongoDB 1.4
Release Notes for MongoDB 1.2.x
Release Notes for MongoDB 2.6 (Development Series 2.5.x)
Default Write Concern Change
About MongoDB Documentation
MongoDB Documentation Style and Conventions
MongoDB Documentation Practices and Processes
MongoDB Documentation Organization
Build and Deploy the MongoDB Documentation
Install MongoDB >
MongoDB Manual
2.4
Contents
Install MongoDB
Administration
Security
Core MongoDB Operations (CRUD)
Data Modeling
Aggregation
Indexes
Replication
Sharding
Application Development
The
mongo
Shell
Use Cases
Frequently Asked Questions
Reference
Release Notes
About MongoDB Documentation
Index
Formats
MongoDB Manual, Single HTML Page
MongoDB Manual, PDF Format
MongoDB Manual, ePub Format
About MongoDB
Introduction
User Community
MongoDB Masters
Planet MongoDB
MongoDB Ecosystem
Drivers and Client libraries
C
(
docs
)
C++
(
docs
)
C#
(
docs
)
Erlang
(
docs
)
Haskell
(
docs
)
Java
(
docs
)
JavaScript
(
docs
)
Perl
(
docs
)
PHP
(
docs
)
Python
(
docs
)
Ruby
(
docs
)
Scala
(
docs
)
Tools and Integration
Platform Integration
MongoDB Resources
Downloads
MongoDB Events
Slides and Video
MongoDB Monitoring Service
(
docs
)
Forums
Blog
Download
Drivers
Events
Translations
Edit this Page
GitHub
Report a Problem