Skip to content

Commit 12aa27d

Browse files
KevinMarthKevin Marth
and
Kevin Marth
authored
feat: support appName option (#347)
Co-authored-by: Kevin Marth <[email protected]>
1 parent 062e9b5 commit 12aa27d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/mongo/url_parser.ex

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ defmodule Mongo.UrlParser do
66
# https://docs.mongodb.com/manual/reference/connection-string/#connections-connection-options
77
@mongo_options %{
88
# Path options
9+
"appName" => :string,
910
"username" => :string,
1011
"password" => :string,
1112
"database" => :string,

test/mongo/url_parser_test.exs

+13
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,18 @@ defmodule Mongo.UrlParserTest do
8383
]
8484
end
8585
end
86+
87+
test "appName option" do
88+
url = "mongodb://USERNAME:PASSWORD@HOST:PORT/DATABASE?ssl=true&replicaSet=globaldb&appName=APP"
89+
assert UrlParser.parse_url(url: url) == [
90+
username: "USERNAME",
91+
password: "PASSWORD",
92+
database: "DATABASE",
93+
app_name: "APP",
94+
set_name: "globaldb",
95+
ssl: true,
96+
seeds: ["HOST:PORT"]
97+
]
98+
end
8699
end
87100
end

0 commit comments

Comments
 (0)