-
Notifications
You must be signed in to change notification settings - Fork 126
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
Allow mongodb+srv:// protocol #222
Conversation
For reference, |
322f973
to
79b4454
Compare
yield ['localhost', 'mongodb://localhost']; | ||
yield ['mongodb://localhost', 'mongodb://localhost']; | ||
if (version_compare(phpversion('mongodb'), '1.4.0', '>=')) { | ||
yield ['mongodb+srv://localhost', 'mongodb+srv://localhost']; |
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.
libmongoc requires that there by only a single hostname and that the hostname string contain at least two dots (https://github.com/mongodb/mongo-c-driver/blob/30085af2124de68fd5ad714309f3ea2688489dee/src/mongoc/mongoc-uri.c#L430). I'm not sure if requiring two dots is correct, as the specification only suggests a hostname and domain suffix. I'll follow up if this turns out to be a libmongoc bug, but let's use foo.example.com
for now.
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.
Ah, this actually isn't a bug. I misread the spec. It requires {hostname}.{domainname}
, where a domain name includes its own dot before the TLD suffix.
There's also a test for this in not-enough-parts.json.
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.
Thanks a lot for finding this!
@malarzm Two builds failed: the first is the test suite sanity check which runs the test suite against The second build that failed seems to have an issue with your data provider. I suppose the lowest version doesn't like your data provider. I'll try bumping phpunit dependency in a separate PR, should be done shortly. |
Thanks @malarzm! |
Failed to parse MongoDB URI: 'mongodb+srv://testuser:passwordfotheuser@cluster0-3xdfs.mongodb.net'. Invalid URI Schema, expecting 'mongodb://'." |
Which versions of |
|
Please post the version of ext-mongodb you’re using. To get you started, you need at least version 1.4.0 of the driver to be using the mongodb+srv protocol, as written above. |
MongoDB support => enabled |
Now its working . Thank you. |
That is a different issue that we're already discussing in doctrine/DoctrineMongoDBBundle#452. Please let's keep the discussion in one place. Thanks. |
This should fix doctrine/DoctrineMongoDBBundle#452