Sha256: ebf45aac5c6ed1c06c0e2d9cd33eb3f06faed88538070326801e63cbb3575dca

Contents?: true

Size: 1.03 KB

Versions: 95

Compression:

Stored size: 1.03 KB

Contents

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

begin
  require 'mongo_mapper'
  require 'irb'
rescue LoadError
  require 'rubygems'
  retry
end

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

95 entries across 95 versions & 13 rubygems

Version Path
jmonteiro-mongo_mapper-0.1.4 bin/mmconsole
jmonteiro-mongo_mapper-0.1.2 bin/mmconsole
jmonteiro-mongo_mapper-0.1.1 bin/mmconsole
jmonteiro-mongo_mapper-0.1.0 bin/mmconsole
mongo_mapper-unstable-2010.1.12 bin/mmconsole
mrkurt-mongo_mapper-0.6.11 bin/mmconsole
mongo_mapper-unstable-2010.1.6 bin/mmconsole
mongo_mapper-unstable-2010.1.5 bin/mmconsole
mongo_mapper-unstable-2010.1.4 bin/mmconsole
tpitale-mongo_mapper-0.6.10 bin/mmconsole
mrkurt-mongo_mapper-0.6.10 bin/mmconsole
mongo_mapper-0.6.10 bin/mmconsole
mrkurt-mongo_mapper-0.6.9 bin/mmconsole
mongo_mapper-0.6.9 bin/mmconsole
mrkurt-mongo_mapper-0.6.8 bin/mmconsole
tpitale-mongo_mapper-0.6.9 bin/mmconsole
mongo_mapper-unstable-2009.12.30 bin/mmconsole
mongo_mapper-unstable-2009.12.29 bin/mmconsole
mongo_mapper-unstable-2009.12.23 bin/mmconsole
mongo_mapper-unstable-2009.12.22 bin/mmconsole