Sha256: c051b7b2bb86bcc8bb04ca9509a369d6b76367f503b9691b4b63233fd8fa3a0b
Contents?: true
Size: 592 Bytes
Versions: 8
Compression:
Stored size: 592 Bytes
Contents
$LOAD_PATH.unshift(File.expand_path('../../../lib', __FILE__)) require 'mongo_mapper' require 'pp' MongoMapper.database = 'testing' class User include MongoMapper::Document key :name, String key :tags, Array end User.collection.drop # empties collection john = User.create(:name => 'John', :tags => %w[ruby mongo], :age => 28) bill = User.create(:name => 'Bill', :tags => %w[ruby mongo], :age => 30) User.set({:name => 'John'}, :tags => %[ruby]) pp john.reload User.set(john.id, :tags => %w[ruby mongo]) pp john.reload john.set(:tags => %w[something different]) pp john.reload
Version data entries
8 entries across 8 versions & 1 rubygems