PHP Velho Oeste 2024

MongoClient::connect

(PECL mongo >=1.3.0)

MongoClient::connectConnects to a database server

Description

public MongoClient::connect ( void ) : bool

Parameters

This function has no parameters.

Return Values

If the connection was successful.

Errors/Exceptions

Throws MongoConnectionException if it fails to connect to the database.

add a note add a note

User Contributed Notes 1 note

up
0
East Ghost Com
7 years ago
(driver) mongo-1.6.14

throws exception

"Database name cannot exceed 63 characters"

whenever it gets a string over 63 chars.

Looking at MongoClient using ReflectionMethod, MongoClient describes itself as having been passed a string containing every server that itself has determined exists in your replicaset.  In other words, if there are 26 servers, MongoClient (using ReflectionMethod) returns its own (supposed) 'connect string' as (in our specific case) having over 397 characters!   So, essentially, it returns data about itself that it was never passed, but rather figured out about itself after invocation.

This is a very exotic error.

Why is there any limit -- particularly one as low as 63 characters -- to the connect string?
To Top