Answer the question
In order to leave comments, you need to log in
Why do I get an Invalid URI Schema, expecting 'mongodb://' error in production?
On local (Win10 + PHP7) everything is ok.
I transfer CMS to the server and I get an error:
Ошибка системы: Failed to parse MongoDB URI: 'mongodb+srv://логин:пароль@cluster-a-a8wbv.gcp.mongodb.net/test?retryWrites=true&w=majority'. Invalid URI Schema, expecting 'mongodb://'.
/var/www/html/vendor/mongodb/mongodb/src/Client.php в строке 87
mongodb://логин:пароль@cluster-a-a8wbv.gcp.mongodb.net/test?retryWrites=true&w=majority
Ошибка системы: No suitable servers found (`serverSelectionTryOnce` set): [Failed to resolve 'cluster-a-a8wbv.gcp.mongodb.net']
/var/www/html/vendor/mongodb/mongodb/src/Collection.php в строке 612
Answer the question
In order to leave comments, you need to log in
Docker because you need to use it and then there will be no such garbage. And in the case, then you have an old version of the lib for working with mongo on the server. If memory serves, then in order to work like srv without +srv, you need to specify some option through ?, just like you specify ?retryWrites=true
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question