I assume you are using jenssegers/laravel-mongodb
package to connect to MongoDB.
You can check the structure for MongoDB DSN for standalone, shared cluster and replica set in the MongoDB docs.
To connect to MongoDB Atlas the dsn
is constructed as follows
'mongodb_conn' => [
'driver' => 'mongodb',
'dsn'=>'mongodb://username:password@host1,host2/defaultauthdb?ssl=true&replicaSet=replicaSet&authSource=admin',
'database' => 'my_data',
]
You're missing the ssl=true
param, but that needs to be supported by your server. So have an eye on that.
I know that you're using +srv
to use TLS/SSL connection but maybe the other format from above works better.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…