对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
Docs 菜单

compactStructuredEncryptionData(数据库命令)

compactStructuredEncryptionData

压缩元数据集合中指定的文档并删除冗余文档。

此命令可用于以下环境中托管的部署:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

注意

This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.

该命令具有以下语法:

db.runCommand(
{
compactStructuredEncryptionData: <collection>,
compactionTokens: {
encryptedFieldPath: bindata,
...
},
}
)

该命令接受以下字段:

字段
类型
说明

compactStructuredEncryptionData

字符串

集合的名称。

compactionTokens

文档

将索引字段映射到压实令牌的文档。

The mongosh provides a wrapper method db.collection.compactStructuredEncryptionData().

内置角色readWriteAnyDatabase和dbOwner提供对资源的compactStructuredEncryptionData操作。

有关示例,请参阅元数据集合压实。