diff --git a/bin/htaccess.yaml b/bin/htaccess.yaml index d9a02e8f353..52bf5c75770 100644 --- a/bin/htaccess.yaml +++ b/bin/htaccess.yaml @@ -1438,6 +1438,14 @@ redirect-path: '/reference/commands' url-base: '/reference/command' type: 'redirect' code: 301 +outputs: + - 'after-v2.2' + - 'manual' +--- +redirect-path: '/reference/collection-validation' +url-base: '/reference/command/validate' +type: 'redirect' +code: 301 outputs: - 'after-v2.2' - 'manual' diff --git a/source/reference.txt b/source/reference.txt index 37d2b9eb486..8a0adf1b400 100644 --- a/source/reference.txt +++ b/source/reference.txt @@ -37,7 +37,7 @@ Status and Reporting reference/database-statistics reference/collection-statistics - reference/collection-validation + reference/command/validate reference/connection-pool-stats reference/current-op reference/database-profiler diff --git a/source/reference/collection-validation.txt b/source/reference/collection-validation.txt deleted file mode 100644 index da403d0bf95..00000000000 --- a/source/reference/collection-validation.txt +++ /dev/null @@ -1,231 +0,0 @@ -========================== -Collection Validation Data -========================== - -.. default-domain:: mongodb - -Synopsis --------- - -The collection validation command checks all of the structures within -a name space for correctness and returns a :term:`document` containing -information regarding the on-disk representation of the collection. - -.. warning:: - - The :dbcommand:`validate` process may consume significant system - resources and impede application performance because it must scan - all data in the collection. - -Run the validation command in the :program:`mongo` shell using the -following form to validate a collection named ``people``: - -.. code-block:: javascript - - db.people.validate() - -Alternatively you can use the command prototype and the -:method:`db.runCommand()` shell helper in the following form: - -.. code-block:: javascript - - db.runCommand( { validate: "people", full: true } ) - db.people.validate(true) - -.. seealso:: :dbcommand:`validate` and :method:`~db.collection.validate()`. - -Values ------- - -.. data:: validate.ns - - The full namespace name of the collection. Namespaces include the - database name and the collection name in the form - ``database.collection``. - -.. data:: validate.firstExtent - - The disk location of the first extent in the collection. The value - of this field also includes the namespace. - -.. data:: validate.lastExtent - - The disk location of the last extent in the collection. The value - of this field also includes the namespace. - -.. data:: validate.extentCount - - The number of extents in the collection. - -.. data:: validate.extents - - :dbcommand:`validate` returns one instance of this document for - every extent in the collection. This sub-document is only returned - when you specify the ``full`` option to the command. - - .. data:: validate.extents.loc - - The disk location for the beginning of this extent. - - .. data:: validate.extents.xnext - - The disk location for the extent following this one. "null" if - this is the end of the linked list of extents. - - .. data:: validate.extents.xprev - - The disk location for the extent preceding this one. "null" if - this is the head of the linked list of extents. - - .. data:: validate.extents.nsdiag - - The namespace this extent belongs to (should be the same as the - namespace shown at the beginning of the validate listing). - - .. data:: validate.extents.size - - The number of bytes in this extent. - - .. data:: validate.extents.firstRecord - - The disk location of the first record in this extent. - - .. data:: validate.extents.lastRecord - - The disk location of the last record in this extent. - -.. data:: validate.datasize - - The number of bytes in all data records. This value does not - include deleted records, nor does it include extent headers, nor - record headers, nor space in a file unallocated to any - extent. :data:`~validate.datasize` includes record :term:`padding`. - -.. data:: validate.nrecords - - The number of :term:`documents ` in the collection. - -.. data:: validate.lastExtentSize - - The size of the last new extent created in this collection. This - value determines the size of the *next* extent created. - -.. data:: validate.padding - - A floating point value between 1 and 2. - - When MongoDB creates a new record it uses the :term:`padding - factor` to determine how much additional space to add to the - record. The padding factor is automatically adjusted by mongo when - it notices that update operations are triggering record moves. - -.. data:: validate.firstExtentDetails - - The size of the first extent created in this collection. This data - is similar to the data provided by the :data:`~validate.extents` - sub-document; however, the data reflects only the first extent in - the collection and is always returned. - - .. data:: validate.firstExtentDetails.loc - - The disk location for the beginning of this extent. - - .. data:: validate.firstExtentDetails.xnext - - The disk location for the extent following this one. "null" if - this is the end of the linked list of extents, which should only - be the case if there is only one extent. - - .. data:: validate.firstExtentDetails.xprev - - The disk location for the extent preceding this one. This should - always be "null." - - .. data:: validate.firstExtentDetails.nsdiag - - The namespace this extent belongs to (should be the same as the - namespace shown at the beginning of the validate listing). - - .. data:: validate.firstExtentDetails.size - - The number of bytes in this extent. - - .. data:: validate.firstExtentDetails.firstRecord - - The disk location of the first record in this extent. - - .. data:: validate.firstExtentDetails.lastRecord - - The disk location of the last record in this extent. - -.. data:: validate.objectsFound - - The number of records actually encountered in a scan of the - collection. This field should have the same value as the - :data:`~validate.nrecords` field. - -.. data:: validate.invalidObjects - - The number of records containing BSON documents that do not pass a - validation check. - - .. note:: - - This field is only included in the validation output when you - specify the ``full`` option. - -.. data:: validate.bytesWithHeaders - - This is similar to datasize, except that :data:`~validate.bytesWithHeaders` - includes the record headers. In version 2.0, record headers are 16 - bytes per document. - - .. note:: - - This field is only included in the validation output when you - specify the ``full`` option. - -.. data:: validate.bytesWithoutHeaders - - :data:`~validate.bytesWithoutHeaders` returns data collected from a scan of - all records. The value should be the same as :data:`~validate.datasize`. - - .. note:: - - This field is only included in the validation output when you - specify the ``full`` option. - -.. data:: validate.deletedCount - - The number of deleted or "free" records in the collection. - -.. data:: validate.deletedSize - - The size of all deleted or "free" records in the collection. - -.. data:: validate.nIndexes - - The number of indexes on the data in the collection. - -.. data:: validate.keysPerIndex - - A document containing a field for each index, named after the - index's name, that contains the number of keys, or documents - referenced, included in the index. - -.. data:: validate.valid - - Boolean. ``true``, unless :dbcommand:`validate` determines that an - aspect of the collection is not valid. When ``false``, see the - :data:`~validate.errors` field for more information. - -.. data:: validate.errors - - Typically empty; however, if the collection is not valid (i.e - :data:`~validate.valid` is false,) this field will contain a message - describing the validation error. - -.. data:: validate.ok - - Set to ``1`` when the command succeeds. If the command fails - the :data:`~validate.ok` field has a value of ``0``. diff --git a/source/reference/command/validate.txt b/source/reference/command/validate.txt index 7ca19c89e5a..6609ef7b94c 100644 --- a/source/reference/command/validate.txt +++ b/source/reference/command/validate.txt @@ -4,19 +4,26 @@ validate .. default-domain:: mongodb +Definition +---------- + .. dbcommand:: validate - The ``validate`` command checks the contents of a namespace by - scanning a collection's data and indexes for correctness. The command - can be slow, particularly on larger data sets: + The :dbcommand:`validate` command checks the structures within a + namespace for correctness by scanning the collection's data and + indexes. The command returns information regarding the on-disk + representation of the collection. + + The ``validate`` command can be slow, particularly on larger data sets. + + The following example validates the contents of the collection named + ``users``. .. code-block:: javascript { validate: "users" } - This command will validate the contents of the collection named - ``users``. You may also specify one of the following - options: + You may also specify one of the following options: - ``full: true`` provides a more thorough scan of the data. @@ -43,3 +50,199 @@ validate .. todo:: link to the document with these statistics .. read-lock + +Output +------ + +.. data:: validate.ns + + The full namespace name of the collection. Namespaces include the + database name and the collection name in the form + ``database.collection``. + +.. data:: validate.firstExtent + + The disk location of the first extent in the collection. The value + of this field also includes the namespace. + +.. data:: validate.lastExtent + + The disk location of the last extent in the collection. The value + of this field also includes the namespace. + +.. data:: validate.extentCount + + The number of extents in the collection. + +.. data:: validate.extents + + :dbcommand:`validate` returns one instance of this document for + every extent in the collection. This sub-document is only returned + when you specify the ``full`` option to the command. + + .. data:: validate.extents.loc + + The disk location for the beginning of this extent. + + .. data:: validate.extents.xnext + + The disk location for the extent following this one. "null" if + this is the end of the linked list of extents. + + .. data:: validate.extents.xprev + + The disk location for the extent preceding this one. "null" if + this is the head of the linked list of extents. + + .. data:: validate.extents.nsdiag + + The namespace this extent belongs to (should be the same as the + namespace shown at the beginning of the validate listing). + + .. data:: validate.extents.size + + The number of bytes in this extent. + + .. data:: validate.extents.firstRecord + + The disk location of the first record in this extent. + + .. data:: validate.extents.lastRecord + + The disk location of the last record in this extent. + +.. data:: validate.datasize + + The number of bytes in all data records. This value does not + include deleted records, nor does it include extent headers, nor + record headers, nor space in a file unallocated to any + extent. :data:`~validate.datasize` includes record :term:`padding`. + +.. data:: validate.nrecords + + The number of :term:`documents ` in the collection. + +.. data:: validate.lastExtentSize + + The size of the last new extent created in this collection. This + value determines the size of the *next* extent created. + +.. data:: validate.padding + + A floating point value between 1 and 2. + + When MongoDB creates a new record it uses the :term:`padding + factor` to determine how much additional space to add to the + record. The padding factor is automatically adjusted by mongo when + it notices that update operations are triggering record moves. + +.. data:: validate.firstExtentDetails + + The size of the first extent created in this collection. This data + is similar to the data provided by the :data:`~validate.extents` + sub-document; however, the data reflects only the first extent in + the collection and is always returned. + + .. data:: validate.firstExtentDetails.loc + + The disk location for the beginning of this extent. + + .. data:: validate.firstExtentDetails.xnext + + The disk location for the extent following this one. "null" if + this is the end of the linked list of extents, which should only + be the case if there is only one extent. + + .. data:: validate.firstExtentDetails.xprev + + The disk location for the extent preceding this one. This should + always be "null." + + .. data:: validate.firstExtentDetails.nsdiag + + The namespace this extent belongs to (should be the same as the + namespace shown at the beginning of the validate listing). + + .. data:: validate.firstExtentDetails.size + + The number of bytes in this extent. + + .. data:: validate.firstExtentDetails.firstRecord + + The disk location of the first record in this extent. + + .. data:: validate.firstExtentDetails.lastRecord + + The disk location of the last record in this extent. + +.. data:: validate.objectsFound + + The number of records actually encountered in a scan of the + collection. This field should have the same value as the + :data:`~validate.nrecords` field. + +.. data:: validate.invalidObjects + + The number of records containing BSON documents that do not pass a + validation check. + + .. note:: + + This field is only included in the validation output when you + specify the ``full`` option. + +.. data:: validate.bytesWithHeaders + + This is similar to datasize, except that :data:`~validate.bytesWithHeaders` + includes the record headers. In version 2.0, record headers are 16 + bytes per document. + + .. note:: + + This field is only included in the validation output when you + specify the ``full`` option. + +.. data:: validate.bytesWithoutHeaders + + :data:`~validate.bytesWithoutHeaders` returns data collected from a scan of + all records. The value should be the same as :data:`~validate.datasize`. + + .. note:: + + This field is only included in the validation output when you + specify the ``full`` option. + +.. data:: validate.deletedCount + + The number of deleted or "free" records in the collection. + +.. data:: validate.deletedSize + + The size of all deleted or "free" records in the collection. + +.. data:: validate.nIndexes + + The number of indexes on the data in the collection. + +.. data:: validate.keysPerIndex + + A document containing a field for each index, named after the + index's name, that contains the number of keys, or documents + referenced, included in the index. + +.. data:: validate.valid + + Boolean. ``true``, unless :dbcommand:`validate` determines that an + aspect of the collection is not valid. When ``false``, see the + :data:`~validate.errors` field for more information. + +.. data:: validate.errors + + Typically empty; however, if the collection is not valid (i.e + :data:`~validate.valid` is false,) this field will contain a message + describing the validation error. + +.. data:: validate.ok + + Set to ``1`` when the command succeeds. If the command fails + the :data:`~validate.ok` field has a value of ``0``. diff --git a/source/reference/method/db.collection.validate.txt b/source/reference/method/db.collection.validate.txt index 5da2c0f3dd3..d73c2c5c1d9 100644 --- a/source/reference/method/db.collection.validate.txt +++ b/source/reference/method/db.collection.validate.txt @@ -26,4 +26,4 @@ db.collection.validate() intensive, and may impact the performance of your MongoDB instance. - .. seealso:: :doc:`/reference/collection-validation` + .. seealso:: :doc:`/reference/command/validate`