File tree Expand file tree Collapse file tree 4 files changed +169
-23
lines changed Expand file tree Collapse file tree 4 files changed +169
-23
lines changed Original file line number Diff line number Diff line change @@ -207,26 +207,3 @@ Before each test case, perform the setup.
207
207
- Otherwise, the field remains unchanged: ` Library Platform `
208
208
209
209
- All other subfields in the ` client ` document remain unchanged from ` updatedClientMetadata ` .
210
-
211
- ### Test 3: Test that metadata is not updated on established connections
212
-
213
- Drivers should verify that appending metadata after ` MongoClient ` initialization does ** not** close existing
214
- connections, and that no new ` hello ` command is sent.
215
-
216
- 1 . Create a ` MongoClient ` instance.
217
-
218
- 2 . Send a ` ping ` command to the server and verify that the command succeeds.
219
-
220
- 3 . Append the following ` DriverInfoOptions ` to the ` MongoClient ` metadata:
221
-
222
- | Field | Value |
223
- | -------- | ------------------ |
224
- | name | framework |
225
- | version | 2.0 |
226
- | platform | Framework Platform |
227
-
228
- 4 . Send a ` ping ` command to the server and verify:
229
-
230
- - The command succeeds.
231
- - No ` hello ` command is sent.
232
- - No ` ConnectionClosedEvent ` is emitted.
Original file line number Diff line number Diff line change
1
+ description : client metadata is not transferred
2
+ schemaVersion : ' 1.9'
3
+ runOnRequirements :
4
+ - minServerVersion : ' 6.0'
5
+ createEntities :
6
+ - client :
7
+ id : &client client
8
+ observeEvents :
9
+ - commandSucceededEvent
10
+ - commandFailedEvent
11
+ - connectionClosedEvent
12
+ - connectionCreatedEvent
13
+ - database :
14
+ id : &database
15
+ client : *client
16
+ databaseName : test
17
+ tests :
18
+ # Test that appending metadata after `MongoClient` initialization does not close existing
19
+ # connections, create new ones, and that no new `hello` command is sent.
20
+ - description : metadata append does not create new connections or close existing ones and no hello command is sent
21
+ operations :
22
+ - name : runCommand
23
+ object : *database
24
+ arguments :
25
+ command :
26
+ ping : 1
27
+ expectResult :
28
+ ok : 1
29
+ - name : appendClientMetadata
30
+ object : *client
31
+ arguments :
32
+ driverInfoOptions :
33
+ name : framework
34
+ version : ' 2.0'
35
+ platform : Framework Platform
36
+ - name : runCommand
37
+ object : *database
38
+ arguments :
39
+ command :
40
+ ping : 1
41
+ expectResult :
42
+ ok : 1
43
+ expectEvents :
44
+ - client : *client
45
+ eventType : cmap
46
+ events :
47
+ # Expect only one connection to be created for the first 'ping' command.
48
+ - connectionCreatedEvent : { }
49
+ - client : *client
50
+ eventType : command
51
+ events :
52
+ - commandSucceededEvent :
53
+ commandName : ping
54
+ - commandSucceededEvent :
55
+ commandName : ping
56
+
Original file line number Diff line number Diff line change
1
+ {
2
+ "description" : " client metadata is not transferred" ,
3
+ "schemaVersion" : " 1.9" ,
4
+ "runOnRequirements" : [
5
+ {
6
+ "minServerVersion" : " 6.0"
7
+ }
8
+ ],
9
+ "createEntities" : [
10
+ {
11
+ "client" : {
12
+ "id" : " client" ,
13
+ "observeEvents" : [
14
+ " commandSucceededEvent" ,
15
+ " commandFailedEvent" ,
16
+ " connectionClosedEvent" ,
17
+ " connectionCreatedEvent"
18
+ ]
19
+ }
20
+ },
21
+ {
22
+ "database" : {
23
+ "id" : " database" ,
24
+ "client" : " client" ,
25
+ "databaseName" : " test"
26
+ }
27
+ }
28
+ ],
29
+ "tests" : [
30
+ {
31
+ "description" : " metadata append does not create new connections or close existing ones and no hello command is sent" ,
32
+ "operations" : [
33
+ {
34
+ "name" : " runCommand" ,
35
+ "object" : " database" ,
36
+ "arguments" : {
37
+ "command" : {
38
+ "ping" : 1
39
+ }
40
+ },
41
+ "expectResult" : {
42
+ "ok" : 1
43
+ }
44
+ },
45
+ {
46
+ "name" : " appendClientMetadata" ,
47
+ "object" : " client" ,
48
+ "arguments" : {
49
+ "driverInfoOptions" : {
50
+ "name" : " framework" ,
51
+ "version" : " 2.0" ,
52
+ "platform" : " Framework Platform"
53
+ }
54
+ }
55
+ },
56
+ {
57
+ "name" : " runCommand" ,
58
+ "object" : " database" ,
59
+ "arguments" : {
60
+ "command" : {
61
+ "ping" : 1
62
+ }
63
+ },
64
+ "expectResult" : {
65
+ "ok" : 1
66
+ }
67
+ }
68
+ ],
69
+ "expectEvents" : [
70
+ {
71
+ "client" : " client" ,
72
+ "eventType" : " cmap" ,
73
+ "events" : [
74
+ {
75
+ "connectionCreatedEvent" : {}
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ "client" : " client" ,
81
+ "eventType" : " command" ,
82
+ "events" : [
83
+ {
84
+ "commandSucceededEvent" : {
85
+ "commandName" : " ping"
86
+ }
87
+ },
88
+ {
89
+ "commandSucceededEvent" : {
90
+ "commandName" : " ping"
91
+ }
92
+ }
93
+ ]
94
+ }
95
+ ]
96
+ }
97
+ ]
98
+ }
99
+
Original file line number Diff line number Diff line change @@ -1311,6 +1311,7 @@ The structure of each object is as follows:
1311
1311
When `failureIsRedacted` is present and its value is `true`, the test runner MUST assert that a failure is present and
1312
1312
that the failure has been redacted according to the rules defined for error redaction in the
1313
1313
[command logging and monitoring specification](../command-logging-and-monitoring/command-logging-and-monitoring.md#security).
1314
+
1314
1315
1315
1316
When `false`, the test runner MUST assert that a failure is present and that the failure has NOT been redacted.
1316
1317
@@ -1491,6 +1492,19 @@ driver behavior when an operation is attempted on a closed client or one of its
1491
1492
1492
1493
<span id="client_createChangeStream"></span>
1493
1494
1495
+ # ### appendMetadata
1496
+
1497
+ Appends client metadata to the client.
1498
+
1499
+ The following arguments are supported :
1500
+
1501
+ - `driverInfoOptions` : Required object with the following fields:
1502
+ - `name` : Required string. The name of the wrapping library or framework.
1503
+ - `version` : Optional string. The version of the wrapping library or framework.
1504
+ - `platform` : Optional string. The platform of the wrapping library or framework.
1505
+
1506
+ See [handshake](../mongodb-handshake/handshake.md#metadata-updates-after-mongoclient-initialization).
1507
+
1494
1508
# ### createChangeStream
1495
1509
1496
1510
Creates a cluster-level change stream and ensures that the server-side cursor has been created.
You can’t perform that action at this time.
0 commit comments