Sha256: 1eee3323eb2a9948abaa8e99510a5e98f4ff864012a0e0e3845ad0e410cb1ca4

Contents?: true

Size: 1.04 KB

Versions: 60

Compression:

Stored size: 1.04 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 = "mm-test"
$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

60 entries across 60 versions & 7 rubygems

Version Path
jonbell-mongo_mapper-0.8.6 bin/mmconsole
ign-mongo_mapper-0.8.6.2 bin/mmconsole
ign-mongo_mapper-0.8.6.1 bin/mmconsole
ssherman-mongo_mapper-0.8.6 bin/mmconsole
mongo_mapper-0.8.6 bin/mmconsole
mongo_mapper-0.8.5 bin/mmconsole
honkster-mongo_mapper-0.8.4 bin/mmconsole
mongo_mapper-0.8.4 bin/mmconsole
mongo_mapper-unstable-2010.08.19 bin/mmconsole
mongo_mapper-unstable-2010.08.18 bin/mmconsole
mongo_mapper-unstable-2010.08.17 bin/mmconsole
mongo_mapper-unstable-2010.08.16 bin/mmconsole
mongo_mapper-unstable-2010.08.15 bin/mmconsole
mongo_mapper-unstable-2010.08.14 bin/mmconsole
mongo_mapper-unstable-2010.08.13 bin/mmconsole
mongo_mapper-unstable-2010.08.12 bin/mmconsole
mongo_mapper-unstable-2010.08.11 bin/mmconsole
mongo_mapper-unstable-2010.08.10 bin/mmconsole
mongo_mapper-unstable-2010.08.09 bin/mmconsole
mongo_mapper-0.8.3 bin/mmconsole