|
| 1 | +======== |
| 2 | +Metadata |
| 3 | +======== |
| 4 | + |
| 5 | +.. default-domain:: mongodb |
| 6 | + |
| 7 | +.. index:: metadata |
| 8 | +.. _metadata-storage: |
| 9 | + |
| 10 | +Metadata Storage |
| 11 | +---------------- |
| 12 | + |
| 13 | +MongoDB stores metadata in :term:`collections <collection>` and in |
| 14 | +:term:`documents <document>`. MongoDB stores metadata as follows: |
| 15 | + |
| 16 | +- System metadata for a given :term:`database` is stored in collections |
| 17 | + that use the ``system`` :term:`namespace`. For a list of ``system`` |
| 18 | + collections and where they are found, see |
| 19 | + :ref:`metadata-system-collections` |
| 20 | + |
| 21 | +- Replication metadata is stored in the ``local`` database, which exists |
| 22 | + only on members of :term:`replica sets <replica set>`. For |
| 23 | + descriptions of the collections that store replication metadata, see |
| 24 | + :ref:`replica-set-local-database`. |
| 25 | + |
| 26 | +- Metadata on document structure is stored in the :term:`BSON` format |
| 27 | + within the document itself. |
| 28 | + |
| 29 | +.. index:: collection; internal collections |
| 30 | +.. index:: internal collections |
| 31 | +.. _metadata-system-collections: |
| 32 | + |
| 33 | +Internal Collections |
| 34 | +-------------------- |
| 35 | + |
| 36 | +MongoDB creates several internal collections to use for system, |
| 37 | +replication, and sharding metadata. They are described in the following |
| 38 | +sections in this manual: |
| 39 | + |
| 40 | +- :ref:`metadata-system-collections` |
| 41 | + |
| 42 | +- :ref:`replica-set-local-database` |
| 43 | + |
| 44 | +- :ref:`sharding-internals-config-database` |
| 45 | + |
| 46 | +.. index:: collection; system |
| 47 | +.. index:: system; collections |
| 48 | +.. index:: system; namespace |
| 49 | +.. index:: namespace; system |
| 50 | +.. _metadata-system-collections: |
| 51 | + |
| 52 | +System Collections |
| 53 | +------------------ |
| 54 | + |
| 55 | +MongoDB stores system information in collections that use the |
| 56 | +``system.*`` :term:`namespace`. This namespace is reserved for system |
| 57 | +information and should not be used for other collections. |
| 58 | + |
| 59 | +System collections include collections that are stored directly in the database as well as |
| 60 | +collections that are stored in the ``local`` database on a :term:`replica set` member. |
| 61 | + |
| 62 | +System collections include these collections stored directly in the database: |
| 63 | + |
| 64 | +.. data:: <database>.system.namespaces |
| 65 | + |
| 66 | + The :data:`<database>.system.namespaces` collection contains |
| 67 | + information about all of the database’s collections. Additional |
| 68 | + namespace metadata exists in the ``database.ns`` files and is opaque. |
| 69 | + |
| 70 | +.. data:: <database>.system.indexes |
| 71 | + |
| 72 | + The :data:`<database>.system.indexes` collection lists all the |
| 73 | + indexes in the database. You add and remove data from this collection |
| 74 | + via the :method:`ensureIndex() <db.collection.ensureIndex()>` and |
| 75 | + :method:`dropIndex() <db.collection.dropIndex()>` |
| 76 | + |
| 77 | +.. data:: <database>.system.profile |
| 78 | + |
| 79 | + The :data:`<database>.system.profile` collection stores database |
| 80 | + profiling information. For information on profiling, see :ref:`database-profiling`. |
| 81 | + |
| 82 | +.. data:: <database>.system.users |
| 83 | + |
| 84 | + The :data:`<database>.system.users` collection stores credentials for |
| 85 | + users who have access to the database. For more information on this collection, see |
| 86 | + :ref:`security-authentication`. |
| 87 | + |
| 88 | +System collections also include collections that are stored in the |
| 89 | +``local`` database on replica set members, when replication is enabled. |
| 90 | +For descriptions of system collections stored in the ``local`` database, |
| 91 | +see :ref:`replica-set-local-database`. |
0 commit comments