Skip Menu |

This queue is for tickets about the Catalyst-Model-MongoDB CPAN distribution.

Report information
The Basics
Id: 124341
Status: new
Priority: 0/
Queue: Catalyst-Model-MongoDB

People
Owner: Nobody in particular
Requestors: scp [...] ebi.ac.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: failed connection with Catalyst::Model::MongoDB
Date: Tue, 6 Feb 2018 16:31:45 +0000
To: bug-Catalyst-Model-MongoDB [...] rt.cpan.org
From: Simon Potter <scp [...] ebi.ac.uk>
I have problems connecting to a MongoDB instance using Catalyst::Model::MongoDB (0.13). Perl v5.26.1 on Ubuntu. I can connect using MongoDB::MongoClient (1.8.1) like this: use MongoDB::MongoClient; $c = MongoDB::MongoClient->new(   host => 'XXX',   username => 'XXX',   password =>'XXX',   auth_mechanism => 'SCRAM-SHA-1',   read_pref_mode => "secondaryPreferred" ); $d = $c->get_database('XXX'); $coll = $d->get_collection('XXX'); $coll->find_one; However, equivalent connection using Cataylist...: use Catalyst::Model::MongoDB; my $c = Catalyst::Model::MongoDB->new(   host => 'XXX',   username => 'XXX',   password =>'XXX',   authenticate => 1,   auth_mechanism => 'SCRAM-SHA-1',   read_pref_mode => "secondaryPreferred",   dbname => 'XXX',   collectionname => 'XXX' ); $coll = $c->get_collection; $coll->find_one; fails with: an authentication error: "MongoDB::DatabaseError: not authorized on XXX to execute command...". The problem appears to be that the instantiated MongoClient (Catalyst/Model/MongoDB:_build_connection) is not provided the user/pass parameters. Adding these to the $conn hash in line 30 appears to fix this, though it seems good to be true, i.e. a problem such as this (if it is a bug) would have been spotted before. Perhaps I'm not using the module incorrectly? Simon