Skip to content

Commit 110aff7

Browse files
committed
fixes #8
1 parent d4a7641 commit 110aff7

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/mongo_db_connection/utils.ex

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ defmodule Mongo.MongoDBConnection.Utils do
44
import Mongo.Messages
55
use Bitwise
66

7-
@reply_cursor_not_found 0x1
8-
@reply_query_failure 0x2
7+
# @reply_cursor_not_found 0x1
8+
# @reply_query_failure 0x2
99
# currently not used @reply_shard_config_stale 0x4
1010
# currently not used @reply_await_capable 0x8
1111

@@ -29,15 +29,14 @@ defmodule Mongo.MongoDBConnection.Utils do
2929
"""
3030
def command(id, command, %{wire_version: version} = state) when is_integer(version) and version >= 6 do
3131

32-
# todo ?
3332
# In case of authenticate sometimes the namespace has to be modified
3433
# If using X509 we need to add the keyword $external to use the external database for the client certificates
35-
#ns = case Keyword.get(command, :mechanism) == "MONGODB-X509" && Keyword.get(command, :authenticate) == 1 do
36-
# true -> namespace("$cmd", nil, "$external")
37-
# false -> namespace("$cmd", state, nil)
38-
#end
34+
db = case Keyword.get(command, :mechanism) == "MONGODB-X509" && Keyword.get(command, :authenticate) == 1 do
35+
true -> "$external"
36+
false -> state.database
37+
end
3938

40-
command = command ++ ["$db": state.database]
39+
command = command ++ ["$db": db]
4140

4241
op_msg(flags: 0, sections: [section(payload_type: 0, payload: payload(doc: command))])
4342
|> post_request(id, state, 0)

0 commit comments

Comments
 (0)