++ed by:

1 non-PAUSE user.

Ronald J. Kimball
and 1 contributors


Catalyst::Plugin::Session::Store::MongoDB - MongoDB session store for Catalyst


In your MyApp.pm:

  use Catalyst qw/
    Session::State::Cookie # or similar

and in your MyApp.conf:

    <client_options>             # if empty, lets MongoDB::MongoClient
      host mongodb://foo:27017   #   use its own defaults
      timeout 10000              # if unspecified, defaults to
      ...                        #   { host => hostname, port => port }
    </client_options>            #   for compatibility with previous versions
    dbname test                  # defaults to catalyst
    collectionname s2            # defaults to session

Then you can use it as usual:

  $c->session->{foo} = 'bar'; # will be saved


Catalyst::Plugin::Session::Store::MongoDB is a session storage plugin using MongoDB (http://www.mongodb.org) as its backend.



Options passed to MongoDB::MongoClient->new(). If a reference to an empty hash is provided, lets MongoDB::MongoClient use its own defaults.

If left unspecified, defaults to the following for compatibility with previous versions of this module:

    host => $self->hostname,
    port => $self->port

Name of the database in which to store session data. Defaults to catalyst.


Name of the collection in which to store session data. Defaults to session.

hostname, port

Deprecated: use client_options instead. Default to localhost and 27017, when used as default for an unspecified client_options for compatibility with previous versions of this module.


See Catalyst::Plugin::Session and Catalyst::Plugin::Session::Store.

Expired Sessions

When getting session data, this store automatically deletes the session if it has expired. Additionally this store implements the optional delete_expired_sessions() method.


Ronald J Kimball, <rjk@tamias.net>

Stefan Völkel, <bd@bc-bd.org> <http://bc-bd.org>

Cory G Watson, <gphat at cpan.org>


Copyright 2010 Stefan Völkel <bd@bc-bd.org>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 or (at your option) any later version, as published by the Free Software Foundation; or the Artistic License.