Sha256: 7de3f94950b9d4af30e72f5b9461f9c08cf9145c03679dd4d204636ef7cb681d
Contents?: true
Size: 429 Bytes
Versions: 6
Compression:
Stored size: 429 Bytes
Contents
module AccessorHelpers def read_key(key) if (doc = collection.find_one(criteria)) value = doc[key] if value.is_a?(::Array) value = value.to_set end value end end def write_key(key, value) if value.is_a?(::Set) value = value.to_a end options = {:upsert => true} updates = {'$set' => {key => value}} collection.update criteria, updates, options end end
Version data entries
6 entries across 6 versions & 1 rubygems