@@ -4,8 +4,8 @@ defmodule Mongo.MongoDBConnection.Utils do
4
4
import Mongo.Messages
5
5
use Bitwise
6
6
7
- @ reply_cursor_not_found 0x1
8
- @ reply_query_failure 0x2
7
+ # @reply_cursor_not_found 0x1
8
+ # @reply_query_failure 0x2
9
9
# currently not used @reply_shard_config_stale 0x4
10
10
# currently not used @reply_await_capable 0x8
11
11
@@ -29,15 +29,14 @@ defmodule Mongo.MongoDBConnection.Utils do
29
29
"""
30
30
def command ( id , command , % { wire_version: version } = state ) when is_integer ( version ) and version >= 6 do
31
31
32
- # todo ?
33
32
# In case of authenticate sometimes the namespace has to be modified
34
33
# 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
39
38
40
- command = command ++ [ "$db": state . database ]
39
+ command = command ++ [ "$db": db ]
41
40
42
41
op_msg ( flags: 0 , sections: [ section ( payload_type: 0 , payload: payload ( doc: command ) ) ] )
43
42
|> post_request ( id , state , 0 )
0 commit comments