Mongo Mapper


The MongoMapper Console is a great way to start playing with MongoMapper. Simply enter mmconsole in your terminal and you will be dropped into irb with MongoMapper included and your database set to ‘mm-test’.

Welcome to the MongoMapper Console!

Example 1:
  things = $db.collection("things")
  things.insert("name" => "Raw Thing")
  things.insert("name" => "Another Thing", "date" =>

  cursor = things.find("name" => "Raw Thing")

Example 2:
  class Thing
    include MongoMapper::Document
    key :name, String, :required => true
    key :date, Time

  thing = = "My thing" =

  all_things = Thing.all
  puts { |object| }.inspect
ruby-1.9.2-p0 :001 >
Fork me on GitHub