Skip to content
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

Support mongodb+srv connection strings #1513

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/arcticdb/adapters/mongo_library_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
class MongoLibraryAdapter(ArcticLibraryAdapter):
@staticmethod
def supports_uri(uri: str) -> bool:
return uri.startswith("mongodb://") # mongo+srv:// support?
return uri.startswith("mongodb://") or uri.startswith("mongodb+srv://")

def __init__(self, uri: str, encoding_version: EncodingVersion, *args, **kwargs):
try:
Expand Down
6 changes: 6 additions & 0 deletions python/tests/integration/arcticdb/test_arctic.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from arcticdb_ext.exceptions import InternalException, UserInputException
from arcticdb_ext.storage import NoDataFoundException
from arcticdb.exceptions import ArcticDbNotYetImplemented, LibraryNotFound, MismatchingLibraryOptions
from arcticdb.adapters.mongo_library_adapter import MongoLibraryAdapter
from arcticdb.arctic import Arctic
from arcticdb.options import LibraryOptions, EnterpriseLibraryOptions
from arcticdb import QueryBuilder
Expand Down Expand Up @@ -914,6 +915,11 @@ def test_s3_force_uri_lib_config_handling(s3_storage):
Arctic(s3_storage.arctic_uri + "&force_uri_lib_config=false")


@pytest.mark.parametrize("connection_string", ("mongodb://blah", "mongodb+srv://blah"))
def test_mongo_connection_string_format(connection_string):
assert MongoLibraryAdapter.supports_uri(connection_string)


# See test of same name in test_normalization.py for V1 API equivalent
def test_norm_failure_error_message(arctic_library):
lib = arctic_library
Expand Down
Loading