Navigation

MongoDB Perl Driver

Deprecation

Version v2.2.0 is the final feature release of the MongoDB Perl driver. The driver is now in a 12-month "sunset" period and will receive security patches and critical bug fixes only. The Perl driver will be end-of-life and unsupported on August 13, 2020.

For more information, read here.

Introduction

This is the official MongoDB Perl Driver.

Installation

The Perl Driver is available through CPAN as the package MongoDB.

You can install the latest stable release by installing the MongoDB package:

$ cpan MongoDB

See Installation for more information.

Connect to MongoDB Atlas

To connect to a MongoDB Atlas cluster, use the Atlas connection string for your cluster:

use MongoDB;

my $client = MongoDB->connect(
  'mongodb+srv://<username>:<password>@<cluster-address>/test?retryWrites=true&w=majority'
);
my $db = $client->get_database( 'test' );

Compatibility

MongoDB Compatibility

Perl DriverMongoDB 4.2MongoDB 4.0MongoDB 3.6MongoDB 3.4MongoDB 3.2MongoDB 3.0MongoDB 2.6
2.2
2.0
1.8
1.6
1.4
1.2
1.0

The driver does not support older versions of MongoDB.

Language Compatibility

The MongoDB Perl driver requires Perl 5.10.1 or later.

How to get help