Open emanation opened 11 years ago
The database name is specified in the Model eg.
class User extends Shanty_Mongo_Document
{
protected static $_db = 'forum';
protected static $_collection = 'user';
}
or in a connection
$connections = array
"host" => "mongohost.local",
"port" => "27017",
"username" => "coolapp",
"password" => "*******",
"database" => "coolapp"
);
Shanty_Mongo::addConnections($connections);
Databases specified on the Model have precedence over a database specified in a connection.
Hello. This is pretty clear https://github.com/coen-hyde/Shanty-Mongo/issues/30 But if username/password has access to specific DB only it's impossible to connect. I cannot login with Mongo shell even if dbname is missed. SO, how can I connect to specific DB? Now I get this:
exception 'MongoConnectionException' with message 'No candidate servers found' in /path/to/my/site/library/Shanty/Mongo/Connection/Group.php:134 Stack trace:
0 /path/to/my/site/library/Shanty/Mongo/Connection/Group.php(134): MongoClient->connect()
1 /path/to/my/site/library/Shanty/Mongo/Connection/Group.php(149): Shanty_Mongo_Connection_Group->getWriteConnection()
2 /path/to/my/site/library/Shanty/Mongo.php(336): Shanty_Mongo_Connection_Group->getReadConnection('default')
3 /path/to/my/site/library/Shanty/Mongo/Collection.php(254): Shanty_Mongo::getReadConnection('default')
4 /path/to/my/site/library/Shanty/Mongo/Collection.php(272): Shanty_Mongo_Collection::getConnection(false)
5 /path/to/my/site/library/Shanty/Mongo/Collection.php(287): Shanty_Mongo_Collection::getMongoDb(false)
6 /path/to/my/site/library/Shanty/Mongo/Collection.php(350): Shanty_Mongo_Collection::getMongoCollection(false)
7 /path/to/my/site/library/Shanty/Mongo/Collection.php(397): Shanty_Mongo_Collection::one(Array, Array)
8 /path/to/my/site/application/controllers/IndexController.php(379): Shanty_Mongo_Collection::fetchOne(Array)
9 /path/to/my/site/application/controllers/IndexController.php(314): IndexController->getFeaturedArticleByChannel('')
10 /mnt/httpd2/htdocs/includes/zf/Zend/Controller/Action.php(516): IndexController->landingpageAction()
11 /mnt/httpd2/htdocs/includes/zf/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('landingpageActi...')
12 /mnt/httpd2/htdocs/includes/zf/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
13 /path/to/my/site/application/Bootstrap.php(114): Zend_Controller_Front->dispatch()
14 /path/to/my/site/public/index.php(44): Bootstrap->runApp()
15 {main}