From 322158a26c5f7acf9efefd664e962ec27456f19a Mon Sep 17 00:00:00 2001 From: Ed Costello Date: Thu, 20 Dec 2012 00:51:37 -0500 Subject: [PATCH] DOCS-771 document config.changelog collection Also corrected shardcollection to shardCollection --- source/core/sharding-internals.txt | 5 +- source/reference/config-database.txt | 97 +++++++++++++++++++++++++++- 2 files changed, 99 insertions(+), 3 deletions(-) diff --git a/source/core/sharding-internals.txt b/source/core/sharding-internals.txt index 848896ed9c5..5f070d2ede4 100644 --- a/source/core/sharding-internals.txt +++ b/source/core/sharding-internals.txt @@ -556,6 +556,7 @@ In general, you should *never* manipulate the content of the config database directly. The ``config`` database contains the following collections: +- :data:`changelog` - :data:`chunks` - :data:`collections` - :data:`databases` @@ -592,14 +593,14 @@ When sharding a :term:`GridFS` store, consider the following: db.fs.chunks.ensureIndex( { files_id : 1 , n : 1 } ) - db.runCommand( { shardcollection : "test.fs.chunks" , key : { files_id : 1 , n : 1 } } ) + db.runCommand( { shardCollection : "test.fs.chunks" , key : { files_id : 1 , n : 1 } } ) You may also want shard using just the ``file_id`` field, as in the following operation: .. code-block:: javascript - db.runCommand( { shardcollection : "test.fs.chunks" , key : { files_id : 1 } } ) + db.runCommand( { shardCollection : "test.fs.chunks" , key : { files_id : 1 } } ) .. note:: diff --git a/source/reference/config-database.txt b/source/reference/config-database.txt index 0a37ff6cdc6..023c574e746 100644 --- a/source/reference/config-database.txt +++ b/source/reference/config-database.txt @@ -32,6 +32,101 @@ Collections .. if we add a collection to the config database here, also update the list on the sharding-internals page. +.. data:: changelog + + The :data:`changelog` collection stores a document for each change to + the metadata of a sharded collection. + + Each document contains the following fields: + + .. data:: changeID + + hostname-time-increment + + .. data:: server + + hostname + + .. data:: clientAddr + + hostname:port of client causing change + + .. data:: time + + time change occurred + + .. data:: what + + Type of change: + + * dropCollection + * dropCollection.start + * dropDatabase + * dropDatabase.start + * moveChunk.start + * moveChunk.commit + * split + * multi-split + + .. data:: ns + + Namespace change affected. + + .. data:: details + + A BSON document of additional details, the contents vary + depending on the type of the change. + + +.. example:: + + The following example displays a single record of a chunk split + from a ``config.changelog`` collection: + + .. code-block:: javascript + + { + "_id" : "d.local-2012-12-11T14:09:21-0", + "server" : "d.local", + "clientAddr" : "127.0.0.1:63381", + "time" : ISODate("2012-12-11T14:09:21.039Z"), + "what" : "split", + "ns" : "snps.elegans", + "details" : { + "before" : { + "min" : { + "snp" : { $minKey : 1 } + }, + "max" : { + "snp" : { $maxKey : 1 } + }, + "lastmod" : Timestamp(1000, 0), + "lastmodEpoch" : ObjectId("000000000000000000000000") + }, + "left" : { + "min" : { + "snp" : { $minKey : 1 } + }, + "max" : { + "snp" : "haw54524" + }, + "lastmod" : Timestamp(1000, 1), + "lastmodEpoch" : ObjectId("50c73e0bca6554d8d3b19a83") + }, + "right" : { + "min" : { + "snp" : "haw54524" + }, + "max" : { + "snp" : { $maxKey : 1 } + }, + "lastmod" : Timestamp(1000, 2), + "lastmodEpoch" : ObjectId("50c73e0bca6554d8d3b19a83") + } + } + } + + .. data:: chunks The :data:`chunks` collection stores a document for each chunk in @@ -187,7 +282,7 @@ Collections mongos> db.getCollection("version").find() { "_id" : 1, "version" : 3 } -.. note:: +.. note:: Like all databases in MongoDB, the ``config`` database contains a :data:`system.indexes` collection contains metadata for all indexes