Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document_managers configuration ignores database value #199

Open
lordnynex opened this issue Nov 5, 2013 · 4 comments
Open

document_managers configuration ignores database value #199

lordnynex opened this issue Nov 5, 2013 · 4 comments
Labels

Comments

@lordnynex
Copy link
Contributor

I'm having an issue where my auth is failing because the document manager name is being used as DB name. It is not possible for me to fix this presently as I have two different document managers pointing to two different mongo clusters that share a common top level database name.

Example:
    document_managers:
        users:
            connection: users
            auto_mapping: true
            logging: true
            database: "production"
            retry_query: 3
            retry_connect: 3
    connections:
        users:
            server: "mongodb://node1:port,node2:port,node3:port"
            options:
                connect: true
                username: "example"
                password: "private"

I would expect this to connect and auth to any one of those three nodes using the database 'production'. Instead, I am seeing failed auth attempts on database 'users'. Are there any work arounds for this?

Additionally there appears to be a hard dependancy on document manager and connection being named the same. If I change the connection name to something else and reference it under the 'connection' key in the document manager configuration I receive an exception about a non-existent dependency.

General info:
Symfony 2.3.6
doctrine/mongo-odm 1.0.@dev
doctrine/mongo-odm-bundle 3.0
@dev

@lordnynex
Copy link
Contributor Author

Just found issue #191 and made the configuration change. I am still not able to get this working. I see it using the connection ID as the DB name.

I've also attempted to append '/dbname' to the doctrine_mongodb.connections.id.server string. The end result is the same. If I append '/dbname' to every hostname in the comma delimited list of hosts in the mongo cluster I end up with a malformed query exception.

@lordnynex
Copy link
Contributor Author

After further testing it appears this bug is caused by defining 'metadata_cache_driver' on the document manager configuration in question. After commenting it out the doctrine_mongodb.connections.id.options.db value is honored.

Problematic configuration was:

            metadata_cache_driver:
                type: memcache
                class: Doctrine\Common\Cache\MemcacheCache
                host: localhost
                port: 11211
                instance_class: Memcache

Personally I can't seem to figure out what the purpose of doctrine_mongodb.document_managers.id.database directive is.

I will leave this bug open as I think there is a valid bug here. I would like to use the cache driver but it is certainly not critical as I can set the documents in cache manually.

@lordnynex
Copy link
Contributor Author

For reference: #200

@asennoussi
Copy link

Same bug here, your workaround didn't work.
I had this bug after securing my Replicaset with keys.
Any idea how to work this out ?
Reference #295

@malarzm malarzm added the bug label Jan 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants