Connecting with a URI causes error #10
Comments
Paul can you show the full uri in your config please? |
mongodb://heroku:@subdomain.mongohq.com:99999/database-name |
We did not change the URI environment variable value at all when we upgraded from mongoid 2. Everything was working fine under the previous version. |
Oh wait, I just realized you put this in the Moped repo... Are you trying to instantiate a Moped session with a URI? That is not allowed... Mongoid support's it in the mongoid.yml, but Moped's API take an array of host/port strings to it's constructor: |
No, I am connecting through mongoid and the uri setting is in our mongoid.yml. I put it in here because the error referred to moped. |
Can you also show me the mongoid.yml please? |
|
First, change this: options: &settings
allow_dynamic_fields: true
identity_map_enabled: false Then they are being extended in the wrong place... Should be: development:
<<: *settings
sessions:
default:
hosts:
- localhost:27017
database: development |
And is your URI really malformed like the one you posted (ie the "mongodb://user:pass@host:port,host:port/database-name |
I've got specs all around this, just added more for when the URI is the default session and not the secondary. With the malformed URL I get a different error - just want confirmation that's what you've got but since my error is different I may need more information to reproduce. |
No, it isn't malformed. When I de-identified it I replaced the password with <password> and it got stripped out. I moved the settings extend to the correct place and it had no affect. It looks like the URI parsing is ignoring the database name at the end. I tried to explicitly set it in the mongoid.yml and got this error:
|
Are there any special characters in your database name maybe? Here's the class that is parsing it - I'm wondering if we have a regex problem... https://github.com/mongoid/mongoid/blob/master/lib/mongoid/sessions/mongo_uri.rb |
There is a hyphen in it but that isn't breaking your regex. I just added a spec to test that specifically and it looks fine. -- Paul On Friday, June 1, 2012 at 9:16 AM, Durran Jordan wrote:
|
Ok, I can reproduce your problem. |
When I set up my configuration with a URI, like for MongoHQ on Heroku, I get the following error:
The operation: # Moped::Protocol::Query
@Length=144
@request_id=5
@response_to=0
@op_code=2004
@flags=[:slave_ok]
@full_collection_name="..."
@Skip=0
@limit=0
@selector={"$query"=>{...}}
@fields=nil>
failed with error 13075: "db name can't be empty"
The text was updated successfully, but these errors were encountered: