MongoClient::connect

(PECL mongo >=1.3.0)

MongoClient::connectПодключается к серверу базы данных

Описание

public MongoClient::connect ( void ) : bool

Список параметров

У этой функции нет параметров.

Возвращаемые значения

Если соединение прошло успешно.

Ошибки

Выдает исключение MongoConnectionException, если не удается подключиться к базе данных.

add a note add a note

User Contributed Notes 1 note

up
0
East Ghost Com
8 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