diff --git a/Sources/BSON/Document/Document+Equatable.swift b/Sources/BSON/Document/Document+Equatable.swift index c44c11a..4308490 100644 --- a/Sources/BSON/Document/Document+Equatable.swift +++ b/Sources/BSON/Document/Document+Equatable.swift @@ -3,3 +3,11 @@ extension Document: Equatable { return lhs.makeData() == rhs.makeData() } } + +extension Document: Hashable { + public func hash(into hasher: inout Hasher) { + self.makeByteBuffer().withUnsafeReadableBytes { buffer in + hasher.combine(bytes: buffer) + } + } +}