Sha256: 5d90cedb03c0c5f3f2aa1f3bf85f3757deaf749c17cb8a797b027ff480f78729

Contents?: true

Size: 1023 Bytes

Versions: 29

Compression:

Stored size: 1023 Bytes

Contents

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

require 'mongomapper'
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 XGen::Mongo::Driver
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

29 entries across 29 versions & 7 rubygems

Version Path
crnixon-mongomapper-0.3.4 bin/mmconsole
djsun-mongomapper-0.3.1.1 bin/mmconsole
djsun-mongomapper-0.3.1 bin/mmconsole
djsun-mongomapper-0.3.3 bin/mmconsole
fcoury-mongomapper-0.3.1 bin/mmconsole
fcoury-mongomapper-0.3.3 bin/mmconsole
fcoury-mongomapper-0.3.4 bin/mmconsole
fcoury-mongomapper-0.3.5 bin/mmconsole
fcoury-mongomapper-0.4.0 bin/mmconsole
hashrocket-mongomapper-0.3.10 bin/mmconsole
hashrocket-mongomapper-0.3.11 bin/mmconsole
hashrocket-mongomapper-0.3.12 bin/mmconsole
hashrocket-mongomapper-0.3.13 bin/mmconsole
hashrocket-mongomapper-0.3.14 bin/mmconsole
hashrocket-mongomapper-0.3.15 bin/mmconsole
hashrocket-mongomapper-0.3.3 bin/mmconsole
hashrocket-mongomapper-0.3.4.1 bin/mmconsole
hashrocket-mongomapper-0.3.4 bin/mmconsole
hashrocket-mongomapper-0.3.5 bin/mmconsole
hashrocket-mongomapper-0.3.6 bin/mmconsole