This section describes the standard format of the MongoDB connection URI used to connect to a MongoDB database server. The format is the same for all official MongoDB drivers. For a list of drivers and links to driver documentation, see MongoDB Drivers and Client Libraries. The following is the standard URI connection scheme:
use MongoDB::Uri;
my MongoDB::Uri $uri-obj .= new(:uri<mongodb://localhost>);
ok $uri-obj.defined, 'T0';
is $uri-obj.server-data<servers>[0]<host>, "localhost", 'T1';
is $uri-obj.server-data<servers>[0]<port>, 27017, 'T2';
✔
T0:
✔
T1: default server name
✔
T2: default port number
In the specification shown above it is necessary to specify at least one host and when there are more, all of these must be defined. In this driver implementation however, it is not necessary when host is localhost. So for this driver it is;