Sha256: 604b579aa2120880c00243a7732ff8c8e9ecba48790071e51b8954f2de318733
Contents?: true
Size: 740 Bytes
Versions: 4
Compression:
Stored size: 740 Bytes
Contents
require "mini_mongo" MiniMongo.configure do|config| config.database_url = "mongodb://:@localhost:27017/posts" end class Post < MiniMongo::Base maps :posts end # Post.insert({:author => "Chuck Norris"}) # => #<Post:0x007fe5240f42c0 @id="5016af53bda74305f1000002", @author="Chuck Norris"> # Post.find("id" => "5016af53bda74305f1000002") # => #<Post:0x007fe5240cc360 @id="5016af53bda74305f1000002", @author="Chuck Norris"> # # Post.update("5016af53bda74305f1000002", "author" => "chuck norris") # => #<Post:0x007fdc7c171c80 @author="chuck norris", @id="5016af53bda74305f1000002"> # #Post.count # => 1 # #Post.remove("5016af53bda74305f1000002") # => true # #Post.remove_all # => true # class Answer < MiniMongo::Base maps :answers end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mini_mongo-0.1.0 | examples/post.rb |
mini_mongo-0.0.4 | examples/post.rb |
mini_mongo-0.0.3 | examples/post.rb |
mini_mongo-0.0.2 | examples/post.rb |