Best practices for efficiently storing md5 hashes in MongoDB
问题 Assuming we have an md5 hash: With ruby: >Digest::MD5.hexdigest("ZZtop") => "d3e5c7c22df12b70e882f593432a3bdd" Possible field types: :type => String :type => Hash Which should I choose? 回答1: Use a String. A Hash in BSON refers to a key-value pair set. 回答2: In MongoDB, hash does not mean a cryptographic fingerprint (as in MD5 or SHA-1). It means hash as in hash table (a data structure that allows the storage of key-value pairs). You have to use a string to store a MD5 fingerprint. 回答3: String,