Skip to content

Commit

Permalink
fix mongo urls - scheme is mongodb, not mongo (thanks Alex Sharp)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Belo committed May 8, 2010
1 parent 0e1eebc commit f402b14
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ the current Heroku app name.

You can change any of these defining the URL it should connect to, like:

export MONGO_URL = mongo://user:pass@localhost:1234/db
export MONGO_URL = mongodb://user:pass@localhost:1234/db

For production, it will fetch the MONGO_URL from the Heroku app config vars.

Expand Down
2 changes: 1 addition & 1 deletion lib/heroku/command/mongo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def heroku_mongo_uri
end

def local_mongo_uri
url = ENV['MONGO_URL'] || "mongo://localhost:27017/#{app}"
url = ENV['MONGO_URL'] || "mongodb://localhost:27017/#{app}"
make_uri(url)
end

Expand Down
8 changes: 4 additions & 4 deletions spec/mongo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
it "rescues exceptions when establishing a connection" do
@mongo.expects(:error)
Mongo::Connection.stubs(:new).raises(Mongo::ConnectionFailure)
@mongo.send(:make_connection, URI.parse('mongo://localhost'))
@mongo.send(:make_connection, URI.parse('mongodb://localhost'))
end

it "rejects urls without host" do
Expand All @@ -31,17 +31,17 @@
end

it "fixes mongohq addresses so it can connect from outside EC2" do
uri = @mongo.send(:make_uri, 'mongo://root:secret@hatch.local.mongohq.com/mydb')
uri = @mongo.send(:make_uri, 'mongodb://root:secret@hatch.local.mongohq.com/mydb')
uri.host.should == 'hatch.mongohq.com'
end

describe "Integration test" do
before do
conn = Mongo::Connection.new
@from = conn.db('heroku-mongo-sync-origin')
@from_uri = URI.parse('mongo://localhost/heroku-mongo-sync-origin')
@from_uri = URI.parse('mongodb://localhost/heroku-mongo-sync-origin')
@to = conn.db('heroku-mongo-sync-dest')
@to_uri = URI.parse('mongo://localhost/heroku-mongo-sync-dest')
@to_uri = URI.parse('mongodb://localhost/heroku-mongo-sync-dest')
clear_collections
end

Expand Down

0 comments on commit f402b14

Please sign in to comment.