Sha256: 7cbc7a2e08f4a894b46708297d65de39df32b7b3036ca83f9cc9c86d89ad6d86
Contents?: true
Size: 595 Bytes
Versions: 1
Compression:
Stored size: 595 Bytes
Contents
require 'moped' require 'bson_minihash' session = Moped::Session.new([ "127.0.0.1:27017" ]) session.use "test" # Digestion mini_hash = BSONMiniHash.digest("Syd Vicious", :md5) session[:artists].insert(name: "Syd Vicious", hash: mini_hash) doc = session[:artists].find(hash: mini_hash).first p doc # Packing a hash you already have mini_hash = BSONMiniHash.pack("3eaace90e5526e5acc96f1d6db146b0ed401c2fe", :sha1) session[:artists].insert(name: "Geddy Lee", hash: mini_hash) doc = session[:artists].find(hash: mini_hash).first 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/moped.rb |