'collection.checksum(withRevisions, withData)' method calculates a checksum for the data in a collection and return it.
127.0.0.1:8529@abc_org> db.user.checksum()
{
"checksum" : "17640099781637852595",
"revision" : "_cRdT1TK---"
}
How the checksum is calculated?
Checksum is the aggregate hash value for all document keys contained in collection collection.
If the argument ‘withRevisions’ is set to true, then revision ids of the documents are also included in the hash calculation.
127.0.0.1:8529@abc_org> db.user.checksum(true) { "checksum" : "9396624658446969436", "revision" : "_cRdT1TK---" }
If the argument ‘withData’ is set to true, then all the user defined document attributes also included in the checksum.
127.0.0.1:8529@abc_org> db.user.checksum(true, true) { "checksum" : "11556877735463680012", "revision" : "_cRdT1TK---" }
No comments:
Post a Comment