Sha256: 4352db4cc69588c774c2bd3425e6727d47948be6ce80b96a2e742763ecb82178
Contents?: true
Size: 592 Bytes
Versions: 1
Compression:
Stored size: 592 Bytes
Contents
require 'mongo' require 'bson_minihash' collection = Mongo::Connection.new('127.0.0.1', 27017).db('test').collection('artists') # Digestion mini_hash = BSONMiniHash.digest("Syd Vicious", :md5) p mini_hash collection.insert(name: "Syd Vicious", hash: mini_hash) doc = collection.find_one(hash: mini_hash) p doc # Packing a hash you already have mini_hash = BSONMiniHash.pack("3eaace90e5526e5acc96f1d6db146b0ed401c2fe", :sha1) collection.insert(name: "Geddy Lee", hash: mini_hash) doc = collection.find_one(hash: mini_hash) p doc # Unpacking a mini hash p BSONMiniHash.unpack(doc['hash'])
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bson_minihash-0.0.1 | examples/mongo.rb |