I have copied my project from production environment into dev environment and so needed to update configs to the ones used for dev environment.
I updated the in app/etc/mongogento.xml and other config files but my Mage code still selects the production mongodb server ("dbserver:27017") instead of the dev mongodb server ("localhost:27017"). I have done a global search but I don't see "dbserver" mentioned anywhere. Tried restarting nginx abd php-fpm too to see if a value from cache is being used but i still get the same error:
Fatal error: Uncaught MongoDB\Driver\Exception\ConnectionTimeoutException: No suitable servers found (`serverSelectionTryOnce` set): [connection timeout calling ismaster on 'dbserver:27017'] in /var/www/api/vendor/mongodb/mongodb/src/functions.php:431 Stack trace: #0 /var/www/api/vendor/mongodb/mongodb/src/functions.php(431): MongoDB\Driver\Manager->selectServer() #1 /var/www/api/vendor/mongodb/mongodb/src/Collection.php(651): MongoDB\select_server() #2 /var/www/api/app/code/community/Smile/MongoCore/Model/Resource/Override/Core/Store/Collection.php(92): MongoDB\Collection->find() #3 /var/www/api/lib/Varien/Data/Collection.php(752): Smile_MongoCore_Model_Resource_Override_Core_Store_Collection->load() #4 /var/www/api/app/code/core/Mage/Core/Model/App.php(636): Varien_Data_Collection->count() #5 /var/www/api/app/code/core/Mage/Core/Model/App.php(477): Mage_Core_Model_App->_initStores() #6 /var/www/api/app/code/core/Mage/Core/Model/App.php(285): Mage_Core_Model_App->_initCurrentStore() #7 /var/www/api/app/Mage.php(627): Mag in /var/www/api/vendor/mongodb/mongodb/src/functions.php on line 431
Note that mongo db connection using MongoDB Client works properly since I am explicitly mentioning the server name like so:
$client = new MongoDB\Client("mongodb://localhost:27017");
My test code producing the error:
$root = (filter_input(INPUT_SERVER, 'DOCUMENT_ROOT'));
require $root. '/vendor/autoload.php'; // include Composer's autoloader
require_once $root . '/app/Mage.php';
Mage::app('admin');