Added options for host and port to example

This commit is contained in:
Adrian Madrid 2008-12-04 15:04:06 -07:00
parent 51dde79ba4
commit 9b5be391ef
1 changed files with 6 additions and 1 deletions

View File

@ -3,7 +3,12 @@ require 'mongo'
include XGen::Mongo::Driver
db = Mongo.new.db('ruby-mongo-demo')
host = ARGV[0] || 'localhost'
port = ARGV[1] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
puts "Connecting to #{host}:#{port}"
db = Mongo.new(host, port).db('ruby-mongo-demo')
coll = db.collection('test')
coll.clear