No suitable servers found on PHP Driver for MongoDB

hi,
This is my first time here… i started using MongoDB, I made a Cluster on Atlas cloud and integrated everything on my CodeIgniter Application.

I am using Official Driver of PHP for MongoDB to connect with cluster and do some operations.

Unfortunatly, When i try any Operation i always get error

No suitable servers found (serverSelectionTryOnce set): [Failed to resolve ‘MY_DOMAIN.SOME_ID.mongodb.net’] | Mongodb::get | Query could not be executed

All my configuration is fine and i am using “STRING” type connection.

if i print $this->conn = new MongoDB\Driver\Manager($this->connString); it give me output like

[conn:Mongodb:private] => MongoDB\Driver\Manager Object
    (
        [uri] => 
mongodb://USERNAME:PASSWRD@CLUSTERNAME.mongodb.net/DB_NAME?retryWrites=true&w=majority
        [cluster] => Array
            (
            )

    )

Composer install the MongoDB PHP Library, don’t use the PHP Extension Driver for MongoDB directly.

2 Likes

I removed everything and reconfigured again same as you mentioned in link… and it worked …may be some extension /library issue… Thanks a lot sir…

1 Like