Database Manual / Reference / Database Commands / Administration

filemd5 (database command数据库命令)

Important

Deprecated command已弃用的命令

This command is deprecated and its use is discouraged as MD5 is no longer considered cryptographically secure.此命令已被弃用,不建议使用,因为MD5不再被认为是加密安全的。

Definition定义

filemd5
The filemd5 command returns the md5 hash for a single file stored using the GridFS specification. filemd5命令返回使用GridFS规范存储的单个文件的md5哈希。Client libraries use this command to verify that files are correctly written to MongoDB. The command takes the files_id of the file in question and the name of the GridFS root collection as arguments.客户端库使用此命令验证文件是否正确写入MongoDB。该命令将所讨论文件的files_id和GridFS根集合的名称作为参数。

Compatibility兼容性

This command is available in deployments hosted in the following environments:此命令在以下环境中托管的部署中可用:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务

Note

This command is supported in all MongoDB Atlas clusters. 所有MongoDB Atlas集群都支持此命令。For information on Atlas support for all commands, see Unsupported Commands.有关Atlas支持所有命令的信息,请参阅不支持的命令

  • MongoDB Enterprise: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本
  • MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本

Syntax语法

The command has the following syntax:该命令具有以下语法:

db.runCommand(
{
filemd5: ObjectId("4f1f10e37671b50e4ecd2776"),
root: "fs"
}
)

MongoDB computes the filemd5 using all data in the GridFS file object pulled sequentially from each chunk in the chunks collection.MongoDB使用从chunks集合中的每个块顺序提取的GridFS文件对象中的所有数据来计算filemd5