PHP Velho Oeste 2024

MongoClient::connect

(PECL mongo >=1.3.0)

MongoClient::connectConecta a un servidor de bases de datos

Descripción

public MongoClient::connect ( void ) : bool

Parámetros

Esta función no tiene parámetros.

Valores devueltos

Si la conexión se realizó con éxito.

Errores/Excepciones

Lanza una MongoConnectionException si falla al conectarse a la base de datos.

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