mongodb/mongo-ruby-driver

View on GitHub
bin/mongo_console

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby

$LOAD_PATH[0, 0] = File.join(File.dirname(__FILE__), '..', 'lib')

require 'mongo'
# include the mongo namespace
include Mongo

begin
  require 'pry'
rescue LoadError
end

begin
  require 'irb'
rescue LoadError
end

if defined?(Pry)
  Pry.config.prompt_name = 'mongo'
  Pry.start
elsif defined?(IRB)
  IRB.start
else
  abort 'LoadError: mongo_console requires Pry or IRB'
end