Sha256: d0821d67a04eca31c0b2125781ab072597354c275a2cf9aec587c6550590be50

Contents?: true

Size: 996 Bytes

Versions: 30

Compression:

Stored size: 996 Bytes

Contents

#!/usr/bin/env ruby
$:.unshift File.dirname(__FILE__)+"/../lib"

require 'mongo_mapper'
require 'irb'

IRB.setup(nil)
irb = IRB::Irb.new

IRB.conf[:MAIN_CONTEXT] = irb.context

irb.context.evaluate("require 'irb/completion'", 0)
irb.context.evaluate(%@
include MongoMapper

MongoMapper.database = "mmtest"
$db = MongoMapper.database

@, 0)

puts %@
Welcome to the MongoMapper Console!

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

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

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

  thing = Thing.new
  thing.name = "My thing"
  thing.date = Time.now
  thing.save

  all_things = Thing.all
  puts all_things.map { |object| object.name }.inspect

@

trap("SIGINT") do
  irb.signal_handle
end
catch(:IRB_EXIT) do
  irb.eval_input
end

Version data entries

30 entries across 30 versions & 3 rubygems

Version Path
mongo_mapper-unstable-2009.11.8 bin/mmconsole
mongo_mapper-unstable-2009.11.6 bin/mmconsole
djsun-mongo_mapper-0.5.8.2 bin/mmconsole
djsun-mongo_mapper-0.5.8.1 bin/mmconsole
djsun-mongo_mapper-0.5.6.6 bin/mmconsole
djsun-mongo_mapper-0.5.6.5 bin/mmconsole
mongo_mapper-unstable-2009.11.2 bin/mmconsole
mongo_mapper-unstable-2009.10.31 bin/mmconsole
mongo_mapper-0.5.8 bin/mmconsole
mongo_mapper-0.5.7 bin/mmconsole
djsun-mongo_mapper-0.5.6.4 bin/mmconsole
djsun-mongo_mapper-0.5.6.3 bin/mmconsole
djsun-mongo_mapper-0.5.6.2 bin/mmconsole
djsun-mongo_mapper-0.5.6.1 bin/mmconsole
mongo_mapper-0.5.6 bin/mmconsole
djsun-mongo_mapper-0.5.5.3 bin/mmconsole
mongo_mapper-unstable-2009.10.16 bin/mmconsole
djsun-mongo_mapper-0.5.5.2 bin/mmconsole
mongo_mapper-0.5.5 bin/mmconsole
mongo_mapper-unstable-2009.10.12 bin/mmconsole