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

Inability to change the collection name in the transport in php-enque/mongodb transport using array as suggested by docs. #1027

Closed
josefsabl opened this issue Feb 21, 2020 · 2 comments
Labels

Comments

@josefsabl
Copy link
Contributor

josefsabl commented Feb 21, 2020

Looking at the: \Enqueue\Mongodb\MongodbConnectionFactory::__construct I was unable to figure out how to customize the name of collection for the queue to be stored in and the documentation is wrong here.

Sending something like this doesn't work although stated by documentation as possible as it gets thrown away by the this line $config = $this->parseDsn(empty($config['dsn']) ? 'mongodb:' : $config['dsn']);.

[
    'dsn' => 'mongodb:',
    'dbname' => 'myProject',
    'collection_name' => '_queue',
];
@josefsabl josefsabl changed the title Inability to change the collection name in the transport in php-enque/mongodb transport Inability to change the collection name in the transport in php-enque/mongodb transport using array as suggested by docs. Feb 21, 2020
@josefsabl
Copy link
Contributor Author

josefsabl commented Mar 17, 2020

The documentation has one more bug that eluded us for some time and fully appeared on the server.

      $config = [
        'dsn' => 'mongodb://127.0.0.1/' - Mongodb connection string. see http://docs.mongodb.org/manual/reference/connection-string/
        'dbname' => 'enqueue',          - database name.
        'collection_name' => 'enqueue'  - collection name
        'polling_interval' => '1000',   - How often query for new messages (milliseconds)
      ]
     
      or
     
      mongodb://127.0.0.1:27017/dbname?polling_interval=1000&enqueue_collection=enqueue

This suggests that dbname in first example is the same thing as dbname in the second example and code indeed tries to work with it like that. This however is not the case.

The MongoDB documentation states that it is NOT a default db, but rather defaultauthdb meaning that it is the database with credentials. On the localhost servers, we don't have database protected by authentication so it worked just fine. But in the production this adapter fails to authenticate because the dbname does not contain credentials.

So AFAIK there is no correct way to specify the database to be used. I will try to refactor and fix it along with #1031.

josefsabl added a commit to josefsabl/php-enqueue-enqueue-dev that referenced this issue Mar 18, 2020
…odbConnectionFactory config, Incorrect MongodbConnectionFactory documentation

Closes: php-enqueue#1031, php-enqueue#1027
@stale
Copy link

stale bot commented Apr 16, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 16, 2020
@stale stale bot closed this as completed Apr 25, 2020
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

1 participant