Database Manual / Reference

System Collections系统集合

Synopsis剧情简介

MongoDB stores system information in collections that use the <database>.system.* namespace, which MongoDB reserves for internal use. Do not create collections that begin with system.MongoDB将系统信息存储在使用<database>.system.*命名空间的集合中,MongoDB保留该命名空间供内部使用。不要创建以system开头的集合。

MongoDB also stores some additional instance-local metadata in the local database local.replset.* namespace, specifically for replication purposes and in the config database for sessions information.MongoDB还在本地数据库local.replset.*命名空间中存储了一些额外的实例本地元数据,专门用于复制目的,并在配置数据库中存储了会话信息

Collections集合

System collections include these collections stored in the admin database:系统集合包括存储在admin数据库中的这些集合:

admin.system.roles
The admin.system.roles collection stores custom roles that administrators create and assign to users to provide access to specific resources.admin.system.roles集合存储管理员创建并分配给用户的自定义角色,以提供对特定资源的访问。
admin.system.users
The admin.system.users collection stores the user's authentication credentials as well as any roles assigned to the user. Users may define authorization roles in the admin.system.roles collection.admin.system.users集合存储用户的身份验证凭据以及分配给用户的任何角色。用户可以在admin.system.roles集合中定义授权角色。
admin.system.version
The admin.system.version collection stores metadata to support internal operations. Do not modify this collection unless specifically instructed to in this documentation or by a MongoDB support engineer.admin.system.version集合存储元数据以支持内部操作。除非本文档或MongoDB支持工程师特别指示,否则不要修改此集合。

System collections include these collections stored in the config database:系统集合包括存储在config数据库中的这些集合:

config.system.indexBuilds
The indexBuilds collection stores information related to in-progress index builds.indexBuilds集合存储与正在进行的索引构建相关的信息。
config.system.preimages
Stores previous versions of modified documents from collections with the changeStreamPreAndPostImages option enabled. The config.system.preimages collection is automatically purged when the pre-images expire. 在启用changeStreamPreAndPostImages选项的情况下,存储集合中已修改文档的先前版本。预映像过期时,config.system.preimages集合会自动清除。For details, see changeStreamOptions.preAndPostImages.expireAfterSeconds.有关详细信息,请参阅changeStreamOptions.preAndPostImages.expireAfterSeconds

Database-Specific Collections数据库特定集合

System collections also include these collections stored directly in each database:系统集合还包括直接存储在每个数据库中的这些集合:

<database>.system.profile
The <database>.system.profile collection stores database profiling information. For information on profiling, see Database Profiler.<database>.system.profile集合存储数据库分析信息。有关分析的信息,请参阅数据库分析器
<database>.system.js
The <database>.system.js collection stores special JavaScript code for use in server side JavaScript. <database>.system.js集合存储用于服务器端JavaScript的特殊JavaScript代码。See Store a JavaScript Function on the Server for more information.有关更多信息,请参阅在服务器上存储JavaScript函数
<database>.system.views

The <database>.system.views collection contains information about each view in the database.<database>.system.views集合包含有关数据库中每个视图的信息。

Starting in MongoDB 5.0, for featureCompatibilityVersion set to "5.0" or greater, users can no longer write directly to the <database>.system.views collection.从MongoDB 5.0开始,对于设置为“5.0”或更高版本的featureCompatibilityVersion,用户不能再直接写入<database>.system.views集合。