Sha256: d9226c7c65be6b5fc3b124369ceca0eea0639faff22404fda8a2664769f029d9
Contents?: true
Size: 391 Bytes
Versions: 5
Compression:
Stored size: 391 Bytes
Contents
module PrimaryKeyFactory # The default mongo primary key factory (BSON::ObjectId) creates ids # with symbol keys. Yodel uses string keys (since records are retrieved # with string keys) so Yodel mongo collections use this pk factory instead. def self.create_pk(doc) doc.has_key?('_id') ? doc : doc.merge!('_id' => self.pk) end def self.pk BSON::ObjectId.new end end
Version data entries
5 entries across 5 versions & 1 rubygems