We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
mongodb+srv:// URIs must not include a port number
from pydantic import BaseModel, MongoDsn class MongoConf(BaseModel): uri:MongoDsn m = MongoConf(uri='mongodb+srv://aaa:bbb@mongo.test.ru/test?ssl=fals') print(m.uri) ### mongodb+srv://aaa:bbb@mongo.test.ru:27017/test?ssl=fals
$ python -c "import pydantic.version; print(pydantic.version.version_info())" pydantic version: 2.3.0 pydantic-core version: 2.6.3 pydantic-core build: profile=release pgo=true install path: /home/tonal/.pyenv/versions/3.11.5/envs/epool-props_service/lib/python3.11/site-packages/pydantic python version: 3.11.5 (main, Aug 25 2023, 14:39:59) [GCC 11.4.0] platform: Linux-6.2.0-32-generic-x86_64-with-glibc2.35 optional deps. installed: ['typing-extensions']
Selected Assignee: @lig
The text was updated successfully, but these errors were encountered:
This issue was previously (#6774) and fixed, but appears to have been reverted in v2.2 (#7116).
For this issue, it is recommended that the following be done:
from typing import Annotated from pydantic.networks import UrlConstraints from pydantic_core import MultiHostUrl MongoSRVDsn = Annotated[MultiHostUrl, UrlConstraints(allowed_schemes=['mongodb+srv'])]
Sorry, something went wrong.
yes @as per #6774 @hudrazine's solution is correct.
Ran into this problem today. Should this solution be mentioned in the docs for mongodsn?
https://docs.pydantic.dev/latest/api/networks/#pydantic.networks.MongoDsn
lig
No branches or pull requests
Initial Checks
Description
mongodb+srv:// URIs must not include a port number
Example Code
Python, Pydantic & OS Version
Selected Assignee: @lig
The text was updated successfully, but these errors were encountered: