-
-
Notifications
You must be signed in to change notification settings - Fork 194
Update Connection.php for add +srv (mongodb+srv) #330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Change position in array
| if (preg_match('/^mongodb(:|\+srv:)\\/\\/.+\\/([^?&]+)/s', $this->dsn, $matches)) { | ||
| $this->_defaultDatabaseName = $matches[2]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (preg_match('/^mongodb(:|\+srv:)\\/\\/.+\\/([^?&]+)/s', $this->dsn, $matches)) { | |
| $this->_defaultDatabaseName = $matches[2]; | |
| if (preg_match('/^mongodb(?:\+srv)?:\\/\\/.+\\/([^?&]+)/s', $this->dsn, $matches)) { | |
| $this->_defaultDatabaseName = $matches[1]; |
|
Also need a line for CHANGELOG.md |
|
i think it is not a good way, because a variety of mongodb connection string patterns exist.(Standalone & Replica Set & Shard). the https://docs.mongodb.com/manual/reference/connection-string/ |
|
Hi @ziaratban , |
|
hi @metola , return [
'class' => 'yii\mongodb\Connection',
'dsn' => 'mongodb://any syntax',
'defaultDatabaseName' => 'myDB', // <<<< required
'enableLogging' => YII_ENV === 'dev',
'enableProfiling' => YII_ENV === 'dev',
]; |
|
Hi @ziaratban , |
Fix issue #304
This is need if you create a cloud cluster https://cloud.mongodb.com/ and need conection mongodb+srv