|
On the https://docs.mongodb.com/ecosystem/drivers/perl/ the section Connect to MongoDB Atlas has a subtle bug because in Perl double quote " and simple quote ' are different. With double quote, something like "@cluster0" becomes interpolated as an undefined variable.
It should be:
use MongoDB;
|
|
my $client = MongoDB->connect(
|
'mongodb+srv://<username>:<password>@<cluster-address>/test?retryWrites=true&w=majority'
|
);
|
my $db = $client->get_database( 'test' );
|
The same problem exists in https://cloud.mongodb.com/
Cluster0 => button connect => open Connect to Cluster0
=> connect your application
=> Choose your driver version => Perl => all version
The 'Full driver example' has a mistake
my $client = MongoDB->connect("mongodb+srv://dev-admin:<password>@cluster0-xxxxx.azure.mongodb.net/test?retryWrites=true&w=majority");
|
Should be written:
my $client = MongoDB->connect('mongodb+srv://dev-admin:<password>@cluster0-xxxxx.azure.mongodb.net/test?retryWrites=true&w=majority');
|
|