Skip to content

First pass authentication problem - redux #31

@cwirtanen

Description

@cwirtanen

Appear to be having the same problem as #10 which was fixed a while back.

Running Mango 1.30 and Mojolicious 7.77.

My first query to MongoDB gives me an authentication error: not authorized for query on test.testcollection at /usr/local/share/perl5/Mango/Cursor/Query.pm line 112

Subsequent queries work fine.


use Mojolicious::Lite;
use Mango;

@ARGV = qw(daemon --listen http://*:5000);

my $muri = 'mongodb://user:pass@localhost/test';
my $mango = Mango->new($muri);

get '/' => sub {
    my $c = shift;
    my $pos = $mango->db->collection('testcollection')->find->all;
    $c->render('json' => $pos);
};
app->start;

Server available at http://127.0.0.1:5000
[Wed May  9 02:15:48 2018] [debug] GET "/"
[Wed May  9 02:15:48 2018] [debug] Routing to a callback
[Wed May  9 02:15:48 2018] [error] not authorized for query on test.testcollection at /usr/local/share/perl5/Mango/Cursor/Query.pm line 112.

[Wed May  9 02:15:48 2018] [debug] Template "exception.development.html.ep" not found
[Wed May  9 02:15:48 2018] [debug] Template "exception.html.ep" not found
[Wed May  9 02:15:48 2018] [debug] Rendering template "mojo/debug.html.ep"
[Wed May  9 02:15:48 2018] [debug] Rendering template "mojo/menubar.html.ep"
[Wed May  9 02:15:48 2018] [debug] Your secret passphrase needs to be changed
[Wed May  9 02:15:48 2018] [debug] 500 Internal Server Error (0.028515s, 35.069/s)
[Wed May  9 02:15:49 2018] [debug] GET "/"
[Wed May  9 02:15:49 2018] [debug] Routing to a callback
[Wed May  9 02:15:49 2018] [debug] 200 OK (0.01038s, 96.339/s)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions