diff --git a/test/command_monitoring/bulkWrite.json b/test/command_monitoring/bulkWrite.json index 2559151ee..bac737c28 100644 --- a/test/command_monitoring/bulkWrite.json +++ b/test/command_monitoring/bulkWrite.json @@ -65,7 +65,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 1 }, "command_name": "insert" @@ -98,7 +98,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 1 }, "command_name": "update" @@ -108,6 +108,7 @@ }, { "description": "A successful unordered bulk write with an unacknowledged write concern", + "comment": "On a 2.4 server, no GLE is sent and requires a client-side manufactured reply", "operation": { "name": "bulkWrite", "arguments": { @@ -150,7 +151,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0 + "ok": 1 }, "command_name": "insert" } @@ -158,4 +159,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/test/command_monitoring/command.json b/test/command_monitoring/command.json index 97527b555..7e1e347be 100644 --- a/test/command_monitoring/command.json +++ b/test/command_monitoring/command.json @@ -34,7 +34,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 1 }, "command_name": "count" @@ -101,7 +101,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 1 }, "command_name": "count" diff --git a/test/command_monitoring/deleteMany.json b/test/command_monitoring/deleteMany.json index 11c48423e..7cd396806 100644 --- a/test/command_monitoring/deleteMany.json +++ b/test/command_monitoring/deleteMany.json @@ -52,7 +52,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 2 }, "command_name": "delete" @@ -96,7 +96,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 0, "writeErrors": [ { diff --git a/test/command_monitoring/deleteOne.json b/test/command_monitoring/deleteOne.json index 22d40122e..0971dfcf2 100644 --- a/test/command_monitoring/deleteOne.json +++ b/test/command_monitoring/deleteOne.json @@ -52,7 +52,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 1 }, "command_name": "delete" @@ -96,7 +96,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 0, "writeErrors": [ { diff --git a/test/command_monitoring/find.json b/test/command_monitoring/find.json index 2d7953123..da1fb2ab6 100644 --- a/test/command_monitoring/find.json +++ b/test/command_monitoring/find.json @@ -86,7 +86,9 @@ "sort": { "_id": 1 }, - "skip": 2, + "skip": { + "$numberLong": "2" + }, "modifiers": { "$comment": "test", "$hint": { @@ -119,7 +121,9 @@ "sort": { "_id": 1 }, - "skip": 2, + "skip": { + "$numberLong": "2" + }, "comment": "test", "hint": { "_id": 1 @@ -179,7 +183,9 @@ "sort": { "_id": 1 }, - "batchSize": 3 + "batchSize": { + "$numberLong": "3" + } } }, "expectations": [ @@ -195,7 +201,9 @@ "sort": { "_id": 1 }, - "batchSize": 3 + "batchSize": { + "$numberLong": "3" + } }, "command_name": "find", "database_name": "command-monitoring-tests" @@ -236,7 +244,9 @@ "$numberLong": "42" }, "collection": "test", - "batchSize": 3 + "batchSize": { + "$numberLong": "3" + } }, "command_name": "getMore", "database_name": "command-monitoring-tests" @@ -282,8 +292,12 @@ "sort": { "_id": 1 }, - "batchSize": 3, - "limit": 4 + "batchSize": { + "$numberLong": "3" + }, + "limit": { + "$numberLong": "4" + } } }, "expectations": [ @@ -299,8 +313,12 @@ "sort": { "_id": 1 }, - "batchSize": 3, - "limit": 4 + "batchSize": { + "$numberLong": "3" + }, + "limit": { + "$numberLong": "4" + } }, "command_name": "find", "database_name": "command-monitoring-tests" @@ -341,7 +359,9 @@ "$numberLong": "42" }, "collection": "test", - "batchSize": 1 + "batchSize": { + "$numberLong": "1" + } }, "command_name": "getMore", "database_name": "command-monitoring-tests" @@ -399,7 +419,9 @@ { "description": "A successful find event with a getmore and the server kills the cursor", "ignore_if_server_version_less_than": "3.1", - "ignore_if_topology_type" : ["sharded"], + "ignore_if_topology_type": [ + "sharded" + ], "operation": { "name": "find", "arguments": { @@ -411,8 +433,12 @@ "sort": { "_id": 1 }, - "batchSize": 3, - "limit": 4 + "batchSize": { + "$numberLong": "3" + }, + "limit": { + "$numberLong": "4" + } } }, "expectations": [ @@ -428,8 +454,12 @@ "sort": { "_id": 1 }, - "batchSize": 3, - "limit": 4 + "batchSize": { + "$numberLong": "3" + }, + "limit": { + "$numberLong": "4" + } }, "command_name": "find", "database_name": "command-monitoring-tests" @@ -470,7 +500,9 @@ "$numberLong": "42" }, "collection": "test", - "batchSize": 1 + "batchSize": { + "$numberLong": "1" + } }, "command_name": "getMore", "database_name": "command-monitoring-tests" diff --git a/test/command_monitoring/insertMany.json b/test/command_monitoring/insertMany.json index 196053658..f2605e3c0 100644 --- a/test/command_monitoring/insertMany.json +++ b/test/command_monitoring/insertMany.json @@ -41,7 +41,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 1 }, "command_name": "insert" @@ -82,7 +82,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 0, "writeErrors": [ { @@ -131,7 +131,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 1 }, "command_name": "insert" diff --git a/test/command_monitoring/insertOne.json b/test/command_monitoring/insertOne.json index f202076a4..877bca1a6 100644 --- a/test/command_monitoring/insertOne.json +++ b/test/command_monitoring/insertOne.json @@ -39,7 +39,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 1 }, "command_name": "insert" @@ -78,7 +78,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 0, "writeErrors": [ { diff --git a/test/command_monitoring/updateMany.json b/test/command_monitoring/updateMany.json index f7e5e8943..8e98fc92f 100644 --- a/test/command_monitoring/updateMany.json +++ b/test/command_monitoring/updateMany.json @@ -63,7 +63,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 2 }, "command_name": "update" @@ -118,7 +118,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 0, "writeErrors": [ { diff --git a/test/command_monitoring/updateOne.json b/test/command_monitoring/updateOne.json index dcc8abc57..565b74970 100644 --- a/test/command_monitoring/updateOne.json +++ b/test/command_monitoring/updateOne.json @@ -63,7 +63,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 1 }, "command_name": "update" @@ -115,7 +115,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 1, "upserted": [ { @@ -176,7 +176,7 @@ { "command_succeeded_event": { "reply": { - "ok": 1.0, + "ok": 1, "n": 0, "writeErrors": [ { diff --git a/test/connection_string/test/invalid-uris.json b/test/connection_string/test/invalid-uris.json index 51a843427..677cb5384 100644 --- a/test/connection_string/test/invalid-uris.json +++ b/test/connection_string/test/invalid-uris.json @@ -1,256 +1,256 @@ { - "tests": [ - { - "auth": null, - "description": "Empty string", - "hosts": null, - "options": null, - "uri": "", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Invalid scheme", - "hosts": null, - "options": null, - "uri": "mongo://localhost:27017", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Missing host", - "hosts": null, - "options": null, - "uri": "mongodb://", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Double colon in host identifier", - "hosts": null, - "options": null, - "uri": "mongodb://localhost::27017", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Double colon in host identifier and trailing slash", - "hosts": null, - "options": null, - "uri": "mongodb://localhost::27017/", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Double colon in host identifier with missing host and port", - "hosts": null, - "options": null, - "uri": "mongodb://::", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Double colon in host identifier with missing port", - "hosts": null, - "options": null, - "uri": "mongodb://localhost,localhost::", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Double colon in host identifier and second host", - "hosts": null, - "options": null, - "uri": "mongodb://localhost::27017,abc", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Invalid port (negative number) with hostname", - "hosts": null, - "options": null, - "uri": "mongodb://localhost:-1", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Invalid port (zero) with hostname", - "hosts": null, - "options": null, - "uri": "mongodb://localhost:0/", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Invalid port (positive number) with hostname", - "hosts": null, - "options": null, - "uri": "mongodb://localhost:65536", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Invalid port (positive number) with hostname and trailing slash", - "hosts": null, - "options": null, - "uri": "mongodb://localhost:65536/", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Invalid port (non-numeric string) with hostname", - "hosts": null, - "options": null, - "uri": "mongodb://localhost:foo", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Invalid port (negative number) with IP literal", - "hosts": null, - "options": null, - "uri": "mongodb://[::1]:-1", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Invalid port (zero) with IP literal", - "hosts": null, - "options": null, - "uri": "mongodb://[::1]:0/", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Invalid port (positive number) with IP literal", - "hosts": null, - "options": null, - "uri": "mongodb://[::1]:65536", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Invalid port (positive number) with IP literal and trailing slash", - "hosts": null, - "options": null, - "uri": "mongodb://[::1]:65536/", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Invalid port (non-numeric string) with IP literal", - "hosts": null, - "options": null, - "uri": "mongodb://[::1]:foo", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Missing delimiting slash between hosts and options", - "hosts": null, - "options": null, - "uri": "mongodb://example.com?w=1", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Incomplete key value pair for option", - "hosts": null, - "options": null, - "uri": "mongodb://example.com/?w", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Username with password containing an unescaped colon", - "hosts": null, - "options": null, - "uri": "mongodb://alice:foo:bar@127.0.0.1", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Username with password containing an unescaped colon", - "hosts": null, - "options": null, - "uri": "mongodb://alice:foo:bar@127.0.0.1", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Username containing an unescaped at-sign", - "hosts": null, - "options": null, - "uri": "mongodb://alice@@127.0.0.1", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Username with password containing an unescaped at-sign", - "hosts": null, - "options": null, - "uri": "mongodb://alice@foo:bar@127.0.0.1", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Username containing an unescaped slash", - "hosts": null, - "options": null, - "uri": "mongodb://alice/@localhost/db", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Username containing unescaped slash with password", - "hosts": null, - "options": null, - "uri": "mongodb://alice/bob:foo@localhost/db", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Username with password containing an unescaped slash", - "hosts": null, - "options": null, - "uri": "mongodb://alice:foo/bar@localhost/db", - "valid": false, - "warning": null - }, - { - "auth": null, - "description": "Host with unescaped slash", - "hosts": null, - "options": null, - "uri": "mongodb:///tmp/mongodb-27017.sock/", - "valid": false, - "warning": null - } - ] + "tests": [ + { + "description": "Empty string", + "uri": "", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Invalid scheme", + "uri": "mongo://localhost:27017", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Missing host", + "uri": "mongodb://", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Double colon in host identifier", + "uri": "mongodb://localhost::27017", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Double colon in host identifier and trailing slash", + "uri": "mongodb://localhost::27017/", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Double colon in host identifier with missing host and port", + "uri": "mongodb://::", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Double colon in host identifier with missing port", + "uri": "mongodb://localhost,localhost::", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Double colon in host identifier and second host", + "uri": "mongodb://localhost::27017,abc", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Invalid port (negative number) with hostname", + "uri": "mongodb://localhost:-1", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Invalid port (zero) with hostname", + "uri": "mongodb://localhost:0/", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Invalid port (positive number) with hostname", + "uri": "mongodb://localhost:65536", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Invalid port (positive number) with hostname and trailing slash", + "uri": "mongodb://localhost:65536/", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Invalid port (non-numeric string) with hostname", + "uri": "mongodb://localhost:foo", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Invalid port (negative number) with IP literal", + "uri": "mongodb://[::1]:-1", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Invalid port (zero) with IP literal", + "uri": "mongodb://[::1]:0/", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Invalid port (positive number) with IP literal", + "uri": "mongodb://[::1]:65536", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Invalid port (positive number) with IP literal and trailing slash", + "uri": "mongodb://[::1]:65536/", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Invalid port (non-numeric string) with IP literal", + "uri": "mongodb://[::1]:foo", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Missing delimiting slash between hosts and options", + "uri": "mongodb://example.com?w=1", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Incomplete key value pair for option", + "uri": "mongodb://example.com/?w", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Username with password containing an unescaped colon", + "uri": "mongodb://alice:foo:bar@127.0.0.1", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Username with password containing an unescaped colon", + "uri": "mongodb://alice:foo:bar@127.0.0.1", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Username containing an unescaped at-sign", + "uri": "mongodb://alice@@127.0.0.1", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Username with password containing an unescaped at-sign", + "uri": "mongodb://alice@foo:bar@127.0.0.1", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Username containing an unescaped slash", + "uri": "mongodb://alice/@localhost/db", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Username containing unescaped slash with password", + "uri": "mongodb://alice/bob:foo@localhost/db", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Username with password containing an unescaped slash", + "uri": "mongodb://alice:foo/bar@localhost/db", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "Host with unescaped slash", + "uri": "mongodb:///tmp/mongodb-27017.sock/", + "valid": false, + "warning": null, + "hosts": null, + "auth": null, + "options": null + } + ] } diff --git a/test/connection_string/test/valid-auth.json b/test/connection_string/test/valid-auth.json index 9cb90c7d0..672777ff8 100644 --- a/test/connection_string/test/valid-auth.json +++ b/test/connection_string/test/valid-auth.json @@ -1,311 +1,311 @@ { - "tests": [ + "tests": [ + { + "description": "User info for single IPv4 host without database", + "uri": "mongodb://alice:foo@127.0.0.1", + "valid": true, + "warning": false, + "hosts": [ { - "auth": { - "db": null, - "password": "foo", - "username": "alice" - }, - "description": "User info for single IPv4 host without database", - "hosts": [ - { - "host": "127.0.0.1", - "port": null, - "type": "ipv4" - } - ], - "options": null, - "uri": "mongodb://alice:foo@127.0.0.1", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "test", - "password": "foo", - "username": "alice" - }, - "description": "User info for single IPv4 host with database", - "hosts": [ - { - "host": "127.0.0.1", - "port": null, - "type": "ipv4" - } - ], - "options": null, - "uri": "mongodb://alice:foo@127.0.0.1/test", - "valid": true, - "warning": false - }, - { - "auth": { - "db": null, - "password": "bar", - "username": "bob" - }, - "description": "User info for single IP literal host without database", - "hosts": [ - { - "host": "::1", - "port": 27018, - "type": "ip_literal" - } - ], - "options": null, - "uri": "mongodb://bob:bar@[::1]:27018", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin", - "password": "bar", - "username": "bob" - }, - "description": "User info for single IP literal host with database", - "hosts": [ - { - "host": "::1", - "port": 27018, - "type": "ip_literal" - } - ], - "options": null, - "uri": "mongodb://bob:bar@[::1]:27018/admin", - "valid": true, - "warning": false - }, - { - "auth": { - "db": null, - "password": "baz", - "username": "eve" - }, - "description": "User info for single hostname without database", - "hosts": [ - { - "host": "example.com", - "port": null, - "type": "hostname" - } - ], - "options": null, - "uri": "mongodb://eve:baz@example.com", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "db2", - "password": "baz", - "username": "eve" - }, - "description": "User info for single hostname with database", - "hosts": [ - { - "host": "example.com", - "port": null, - "type": "hostname" - } - ], - "options": null, - "uri": "mongodb://eve:baz@example.com/db2", - "valid": true, - "warning": false - }, - { - "auth": { - "db": null, - "password": "secret", - "username": "alice" - }, - "description": "User info for multiple hosts without database", - "hosts": [ - { - "host": "127.0.0.1", - "port": null, - "type": "ipv4" - }, - { - "host": "example.com", - "port": 27018, - "type": "hostname" - } - ], - "options": null, - "uri": "mongodb://alice:secret@127.0.0.1,example.com:27018", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin", - "password": "secret", - "username": "alice" - }, - "description": "User info for multiple hosts with database", - "hosts": [ - { - "host": "example.com", - "port": null, - "type": "hostname" - }, - { - "host": "::1", - "port": 27019, - "type": "ip_literal" - } - ], - "options": null, - "uri": "mongodb://alice:secret@example.com,[::1]:27019/admin", - "valid": true, - "warning": false - }, - { - "auth": { - "db": null, - "password": null, - "username": "alice" - }, - "description": "Username without password", - "hosts": [ - { - "host": "127.0.0.1", - "port": null, - "type": "ipv4" - } - ], - "options": null, - "uri": "mongodb://alice@127.0.0.1", - "valid": true, - "warning": false - }, - { - "auth": { - "db": null, - "password": "", - "username": "alice" - }, - "description": "Username with empty password", - "hosts": [ - { - "host": "127.0.0.1", - "port": null, - "type": "ipv4" - } - ], - "options": null, - "uri": "mongodb://alice:@127.0.0.1", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "my=db", - "password": null, - "username": "@l:ce/=" - }, - "description": "Escaped username and database without password", - "hosts": [ - { - "host": "example.com", - "port": null, - "type": "hostname" - } - ], - "options": null, - "uri": "mongodb://%40l%3Ace%2F%3D@example.com/my%3Ddb", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin?", - "password": "f:zzb@z/z=", - "username": "$am" - }, - "description": "Escaped user info and database (MONGODB-CR)", - "hosts": [ - { - "host": "127.0.0.1", - "port": null, - "type": "ipv4" - } - ], - "options": { - "authmechanism": "MONGODB-CR" - }, - "uri": "mongodb://%24am:f%3Azzb%40z%2Fz%3D@127.0.0.1/admin%3F?authMechanism=MONGODB-CR", - "valid": true, - "warning": false - }, - { - "auth": { - "db": null, - "password": null, - "username": "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry" - }, - "description": "Escaped username (MONGODB-X509)", - "hosts": [ - { - "host": "localhost", - "port": null, - "type": "hostname" - } - ], - "options": { - "authmechanism": "MONGODB-X509" - }, - "uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509", - "valid": true, - "warning": false - }, - { - "auth": { - "db": null, - "password": "secret", - "username": "user@EXAMPLE.COM" - }, - "description": "Escaped username (GSSAPI)", - "hosts": [ - { - "host": "localhost", - "port": null, - "type": "hostname" - } - ], - "options": { - "authmechanism": "GSSAPI", - "authmechanismproperties": { - "CANONICALIZE_HOST_NAME": true, - "SERVICE_NAME": "other" - } - }, - "uri": "mongodb://user%40EXAMPLE.COM:secret@localhost/?authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true&authMechanism=GSSAPI", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin", - "password": "secret", - "username": "alice" - }, - "description": "At-signs in options aren't part of the userinfo", - "hosts": [ - { - "host": "example.com", - "port": null, - "type": "hostname" - } - ], - "options": { - "replicaset": "my@replicaset" - }, - "uri": "mongodb://alice:secret@example.com/admin?replicaset=my@replicaset", - "valid": true, - "warning": false + "type": "ipv4", + "host": "127.0.0.1", + "port": null } - ] + ], + "auth": { + "username": "alice", + "password": "foo", + "db": null + }, + "options": null + }, + { + "description": "User info for single IPv4 host with database", + "uri": "mongodb://alice:foo@127.0.0.1/test", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "ipv4", + "host": "127.0.0.1", + "port": null + } + ], + "auth": { + "username": "alice", + "password": "foo", + "db": "test" + }, + "options": null + }, + { + "description": "User info for single IP literal host without database", + "uri": "mongodb://bob:bar@[::1]:27018", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "ip_literal", + "host": "::1", + "port": 27018 + } + ], + "auth": { + "username": "bob", + "password": "bar", + "db": null + }, + "options": null + }, + { + "description": "User info for single IP literal host with database", + "uri": "mongodb://bob:bar@[::1]:27018/admin", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "ip_literal", + "host": "::1", + "port": 27018 + } + ], + "auth": { + "username": "bob", + "password": "bar", + "db": "admin" + }, + "options": null + }, + { + "description": "User info for single hostname without database", + "uri": "mongodb://eve:baz@example.com", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "hostname", + "host": "example.com", + "port": null + } + ], + "auth": { + "username": "eve", + "password": "baz", + "db": null + }, + "options": null + }, + { + "description": "User info for single hostname with database", + "uri": "mongodb://eve:baz@example.com/db2", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "hostname", + "host": "example.com", + "port": null + } + ], + "auth": { + "username": "eve", + "password": "baz", + "db": "db2" + }, + "options": null + }, + { + "description": "User info for multiple hosts without database", + "uri": "mongodb://alice:secret@127.0.0.1,example.com:27018", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "ipv4", + "host": "127.0.0.1", + "port": null + }, + { + "type": "hostname", + "host": "example.com", + "port": 27018 + } + ], + "auth": { + "username": "alice", + "password": "secret", + "db": null + }, + "options": null + }, + { + "description": "User info for multiple hosts with database", + "uri": "mongodb://alice:secret@example.com,[::1]:27019/admin", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "hostname", + "host": "example.com", + "port": null + }, + { + "type": "ip_literal", + "host": "::1", + "port": 27019 + } + ], + "auth": { + "username": "alice", + "password": "secret", + "db": "admin" + }, + "options": null + }, + { + "description": "Username without password", + "uri": "mongodb://alice@127.0.0.1", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "ipv4", + "host": "127.0.0.1", + "port": null + } + ], + "auth": { + "username": "alice", + "password": null, + "db": null + }, + "options": null + }, + { + "description": "Username with empty password", + "uri": "mongodb://alice:@127.0.0.1", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "ipv4", + "host": "127.0.0.1", + "port": null + } + ], + "auth": { + "username": "alice", + "password": "", + "db": null + }, + "options": null + }, + { + "description": "Escaped username and database without password", + "uri": "mongodb://%40l%3Ace%2F%3D@example.com/my%3Ddb", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "hostname", + "host": "example.com", + "port": null + } + ], + "auth": { + "username": "@l:ce/=", + "password": null, + "db": "my=db" + }, + "options": null + }, + { + "description": "Escaped user info and database (MONGODB-CR)", + "uri": "mongodb://%24am:f%3Azzb%40z%2Fz%3D@127.0.0.1/admin%3F?authMechanism=MONGODB-CR", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "ipv4", + "host": "127.0.0.1", + "port": null + } + ], + "auth": { + "username": "$am", + "password": "f:zzb@z/z=", + "db": "admin?" + }, + "options": { + "authmechanism": "MONGODB-CR" + } + }, + { + "description": "Escaped username (MONGODB-X509)", + "uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "hostname", + "host": "localhost", + "port": null + } + ], + "auth": { + "username": "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry", + "password": null, + "db": null + }, + "options": { + "authmechanism": "MONGODB-X509" + } + }, + { + "description": "Escaped username (GSSAPI)", + "uri": "mongodb://user%40EXAMPLE.COM:secret@localhost/?authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true&authMechanism=GSSAPI", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "hostname", + "host": "localhost", + "port": null + } + ], + "auth": { + "username": "user@EXAMPLE.COM", + "password": "secret", + "db": null + }, + "options": { + "authmechanism": "GSSAPI", + "authmechanismproperties": { + "SERVICE_NAME": "other", + "CANONICALIZE_HOST_NAME": true + } + } + }, + { + "description": "At-signs in options aren't part of the userinfo", + "uri": "mongodb://alice:secret@example.com/admin?replicaset=my@replicaset", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "hostname", + "host": "example.com", + "port": null + } + ], + "auth": { + "username": "alice", + "password": "secret", + "db": "admin" + }, + "options": { + "replicaset": "my@replicaset" + } + } + ] } diff --git a/test/connection_string/test/valid-db-with-dotted-name.json b/test/connection_string/test/valid-db-with-dotted-name.json index c3349859e..5b5aaa5ee 100644 --- a/test/connection_string/test/valid-db-with-dotted-name.json +++ b/test/connection_string/test/valid-db-with-dotted-name.json @@ -1,100 +1,100 @@ { - "tests": [ + "tests": [ + { + "description": "Multiple Unix domain sockets and auth DB resembling a socket (relative path)", + "uri": "mongodb://rel%2Fmongodb-27017.sock,rel%2Fmongodb-27018.sock/admin.sock", + "valid": true, + "warning": false, + "hosts": [ { - "auth": { - "db": "admin.sock", - "password": null, - "username": null - }, - "description": "Multiple Unix domain sockets and auth DB resembling a socket (relative path)", - "hosts": [ - { - "host": "rel/mongodb-27017.sock", - "port": null, - "type": "unix" - }, - { - "host": "rel/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://rel%2Fmongodb-27017.sock,rel%2Fmongodb-27018.sock/admin.sock", - "valid": true, - "warning": false - }, + "type": "unix", + "host": "rel/mongodb-27017.sock", + "port": null + }, { - "auth": { - "db": "admin.shoe", - "password": null, - "username": null - }, - "description": "Multiple Unix domain sockets with auth DB resembling a path (relative path)", - "hosts": [ - { - "host": "rel/mongodb-27017.sock", - "port": null, - "type": "unix" - }, - { - "host": "rel/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://rel%2Fmongodb-27017.sock,rel%2Fmongodb-27018.sock/admin.shoe", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin.sock", - "password": null, - "username": null - }, - "description": "Multiple Unix domain sockets and auth DB resembling a socket (absolute path)", - "hosts": [ - { - "host": "/tmp/mongodb-27017.sock", - "port": null, - "type": "unix" - }, - { - "host": "/tmp/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://%2Ftmp%2Fmongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock/admin.sock", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin.shoe", - "password": null, - "username": null - }, - "description": "Multiple Unix domain sockets with auth DB resembling a path (absolute path)", - "hosts": [ - { - "host": "/tmp/mongodb-27017.sock", - "port": null, - "type": "unix" - }, - { - "host": "/tmp/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://%2Ftmp%2Fmongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock/admin.shoe", - "valid": true, - "warning": false + "type": "unix", + "host": "rel/mongodb-27018.sock", + "port": null } - ] + ], + "auth": { + "username": null, + "password": null, + "db": "admin.sock" + }, + "options": null + }, + { + "description": "Multiple Unix domain sockets with auth DB resembling a path (relative path)", + "uri": "mongodb://rel%2Fmongodb-27017.sock,rel%2Fmongodb-27018.sock/admin.shoe", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "rel/mongodb-27017.sock", + "port": null + }, + { + "type": "unix", + "host": "rel/mongodb-27018.sock", + "port": null + } + ], + "auth": { + "username": null, + "password": null, + "db": "admin.shoe" + }, + "options": null + }, + { + "description": "Multiple Unix domain sockets and auth DB resembling a socket (absolute path)", + "uri": "mongodb://%2Ftmp%2Fmongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock/admin.sock", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "/tmp/mongodb-27017.sock", + "port": null + }, + { + "type": "unix", + "host": "/tmp/mongodb-27018.sock", + "port": null + } + ], + "auth": { + "username": null, + "password": null, + "db": "admin.sock" + }, + "options": null + }, + { + "description": "Multiple Unix domain sockets with auth DB resembling a path (absolute path)", + "uri": "mongodb://%2Ftmp%2Fmongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock/admin.shoe", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "/tmp/mongodb-27017.sock", + "port": null + }, + { + "type": "unix", + "host": "/tmp/mongodb-27018.sock", + "port": null + } + ], + "auth": { + "username": null, + "password": null, + "db": "admin.shoe" + }, + "options": null + } + ] } diff --git a/test/connection_string/test/valid-host_identifiers.json b/test/connection_string/test/valid-host_identifiers.json index f33358725..e8833b4af 100644 --- a/test/connection_string/test/valid-host_identifiers.json +++ b/test/connection_string/test/valid-host_identifiers.json @@ -132,18 +132,18 @@ }, { "description": "UTF-8 hosts", - "uri": "mongodb://b\u00fccher.example.com,uml\u00e4ut.example.com/", + "uri": "mongodb://bücher.example.com,umläut.example.com/", "valid": true, "warning": false, "hosts": [ { "type": "hostname", - "host": "b\u00fccher.example.com", + "host": "bücher.example.com", "port": null }, { "type": "hostname", - "host": "uml\u00e4ut.example.com", + "host": "umläut.example.com", "port": null } ], diff --git a/test/connection_string/test/valid-unix_socket-absolute.json b/test/connection_string/test/valid-unix_socket-absolute.json index 6c60369f4..5bb02476e 100644 --- a/test/connection_string/test/valid-unix_socket-absolute.json +++ b/test/connection_string/test/valid-unix_socket-absolute.json @@ -1,251 +1,251 @@ { - "tests": [ + "tests": [ + { + "description": "Unix domain socket (absolute path with trailing slash)", + "uri": "mongodb://%2Ftmp%2Fmongodb-27017.sock/", + "valid": true, + "warning": false, + "hosts": [ { - "auth": null, - "description": "Unix domain socket (absolute path with trailing slash)", - "hosts": [ - { - "host": "/tmp/mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://%2Ftmp%2Fmongodb-27017.sock/", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Unix domain socket (absolute path without trailing slash)", - "hosts": [ - { - "host": "/tmp/mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://%2Ftmp%2Fmongodb-27017.sock", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Unix domain socket (absolute path with spaces in path)", - "hosts": [ - { - "host": "/tmp/ /mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://%2Ftmp%2F %2Fmongodb-27017.sock", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Multiple Unix domain sockets (absolute paths)", - "hosts": [ - { - "host": "/tmp/mongodb-27017.sock", - "port": null, - "type": "unix" - }, - { - "host": "/tmp/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://%2Ftmp%2Fmongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Multiple hosts (absolute path and ipv4)", - "hosts": [ - { - "host": "127.0.0.1", - "port": 27017, - "type": "ipv4" - }, - { - "host": "/tmp/mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://127.0.0.1:27017,%2Ftmp%2Fmongodb-27017.sock", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Multiple hosts (absolute path and hostname resembling relative path)", - "hosts": [ - { - "host": "mongodb-27017.sock", - "port": null, - "type": "hostname" - }, - { - "host": "/tmp/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://mongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin", - "password": "foo", - "username": "alice" - }, - "description": "Unix domain socket with auth database (absolute path)", - "hosts": [ - { - "host": "/tmp/mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://alice:foo@%2Ftmp%2Fmongodb-27017.sock/admin", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Unix domain socket with path resembling socket file (absolute path with trailing slash)", - "hosts": [ - { - "host": "/tmp/path.to.sock/mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://%2Ftmp%2Fpath.to.sock%2Fmongodb-27017.sock/", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Unix domain socket with path resembling socket file (absolute path without trailing slash)", - "hosts": [ - { - "host": "/tmp/path.to.sock/mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://%2Ftmp%2Fpath.to.sock%2Fmongodb-27017.sock", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin", - "password": "bar", - "username": "bob" - }, - "description": "Unix domain socket with path resembling socket file and auth (absolute path)", - "hosts": [ - { - "host": "/tmp/path.to.sock/mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://bob:bar@%2Ftmp%2Fpath.to.sock%2Fmongodb-27017.sock/admin", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin", - "password": null, - "username": null - }, - "description": "Multiple Unix domain sockets and auth DB (absolute path)", - "hosts": [ - { - "host": "/tmp/mongodb-27017.sock", - "port": null, - "type": "unix" - }, - { - "host": "/tmp/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://%2Ftmp%2Fmongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock/admin", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin", - "password": null, - "username": null - }, - "description": "Multiple Unix domain sockets with auth DB (absolute path)", - "hosts": [ - { - "host": "/tmp/mongodb-27017.sock", - "port": null, - "type": "unix" - }, - { - "host": "/tmp/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://%2Ftmp%2Fmongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock/admin", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin", - "password": "bar", - "username": "bob" - }, - "description": "Multiple Unix domain sockets with auth and query string (absolute path)", - "hosts": [ - { - "host": "/tmp/mongodb-27017.sock", - "port": null, - "type": "unix" - }, - { - "host": "/tmp/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": { - "w": 1 - }, - "uri": "mongodb://bob:bar@%2Ftmp%2Fmongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock/admin?w=1", - "valid": true, - "warning": false + "type": "unix", + "host": "/tmp/mongodb-27017.sock", + "port": null } - ] + ], + "auth": null, + "options": null + }, + { + "description": "Unix domain socket (absolute path without trailing slash)", + "uri": "mongodb://%2Ftmp%2Fmongodb-27017.sock", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "/tmp/mongodb-27017.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Unix domain socket (absolute path with spaces in path)", + "uri": "mongodb://%2Ftmp%2F %2Fmongodb-27017.sock", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "/tmp/ /mongodb-27017.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Multiple Unix domain sockets (absolute paths)", + "uri": "mongodb://%2Ftmp%2Fmongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "/tmp/mongodb-27017.sock", + "port": null + }, + { + "type": "unix", + "host": "/tmp/mongodb-27018.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Multiple hosts (absolute path and ipv4)", + "uri": "mongodb://127.0.0.1:27017,%2Ftmp%2Fmongodb-27017.sock", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "ipv4", + "host": "127.0.0.1", + "port": 27017 + }, + { + "type": "unix", + "host": "/tmp/mongodb-27017.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Multiple hosts (absolute path and hostname resembling relative path)", + "uri": "mongodb://mongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "hostname", + "host": "mongodb-27017.sock", + "port": null + }, + { + "type": "unix", + "host": "/tmp/mongodb-27018.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Unix domain socket with auth database (absolute path)", + "uri": "mongodb://alice:foo@%2Ftmp%2Fmongodb-27017.sock/admin", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "/tmp/mongodb-27017.sock", + "port": null + } + ], + "auth": { + "username": "alice", + "password": "foo", + "db": "admin" + }, + "options": null + }, + { + "description": "Unix domain socket with path resembling socket file (absolute path with trailing slash)", + "uri": "mongodb://%2Ftmp%2Fpath.to.sock%2Fmongodb-27017.sock/", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "/tmp/path.to.sock/mongodb-27017.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Unix domain socket with path resembling socket file (absolute path without trailing slash)", + "uri": "mongodb://%2Ftmp%2Fpath.to.sock%2Fmongodb-27017.sock", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "/tmp/path.to.sock/mongodb-27017.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Unix domain socket with path resembling socket file and auth (absolute path)", + "uri": "mongodb://bob:bar@%2Ftmp%2Fpath.to.sock%2Fmongodb-27017.sock/admin", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "/tmp/path.to.sock/mongodb-27017.sock", + "port": null + } + ], + "auth": { + "username": "bob", + "password": "bar", + "db": "admin" + }, + "options": null + }, + { + "description": "Multiple Unix domain sockets and auth DB (absolute path)", + "uri": "mongodb://%2Ftmp%2Fmongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock/admin", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "/tmp/mongodb-27017.sock", + "port": null + }, + { + "type": "unix", + "host": "/tmp/mongodb-27018.sock", + "port": null + } + ], + "auth": { + "username": null, + "password": null, + "db": "admin" + }, + "options": null + }, + { + "description": "Multiple Unix domain sockets with auth DB (absolute path)", + "uri": "mongodb://%2Ftmp%2Fmongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock/admin", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "/tmp/mongodb-27017.sock", + "port": null + }, + { + "type": "unix", + "host": "/tmp/mongodb-27018.sock", + "port": null + } + ], + "auth": { + "username": null, + "password": null, + "db": "admin" + }, + "options": null + }, + { + "description": "Multiple Unix domain sockets with auth and query string (absolute path)", + "uri": "mongodb://bob:bar@%2Ftmp%2Fmongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock/admin?w=1", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "/tmp/mongodb-27017.sock", + "port": null + }, + { + "type": "unix", + "host": "/tmp/mongodb-27018.sock", + "port": null + } + ], + "auth": { + "username": "bob", + "password": "bar", + "db": "admin" + }, + "options": { + "w": 1 + } + } + ] } diff --git a/test/connection_string/test/valid-unix_socket-relative.json b/test/connection_string/test/valid-unix_socket-relative.json index 9282bfde4..2ce649ffc 100644 --- a/test/connection_string/test/valid-unix_socket-relative.json +++ b/test/connection_string/test/valid-unix_socket-relative.json @@ -1,271 +1,271 @@ { - "tests": [ + "tests": [ + { + "description": "Unix domain socket (relative path with trailing slash)", + "uri": "mongodb://rel%2Fmongodb-27017.sock/", + "valid": true, + "warning": false, + "hosts": [ { - "auth": null, - "description": "Unix domain socket (relative path with trailing slash)", - "hosts": [ - { - "host": "rel/mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://rel%2Fmongodb-27017.sock/", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Unix domain socket (relative path without trailing slash)", - "hosts": [ - { - "host": "rel/mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://rel%2Fmongodb-27017.sock", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Unix domain socket (relative path with spaces)", - "hosts": [ - { - "host": "rel/ /mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://rel%2F %2Fmongodb-27017.sock", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Multiple Unix domain sockets (relative paths)", - "hosts": [ - { - "host": "rel/mongodb-27017.sock", - "port": null, - "type": "unix" - }, - { - "host": "rel/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://rel%2Fmongodb-27017.sock,rel%2Fmongodb-27018.sock", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Multiple Unix domain sockets (relative and absolute paths)", - "hosts": [ - { - "host": "rel/mongodb-27017.sock", - "port": null, - "type": "unix" - }, - { - "host": "/tmp/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://rel%2Fmongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Multiple hosts (relative path and ipv4)", - "hosts": [ - { - "host": "127.0.0.1", - "port": 27017, - "type": "ipv4" - }, - { - "host": "rel/mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://127.0.0.1:27017,rel%2Fmongodb-27017.sock", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Multiple hosts (relative path and hostname resembling relative path)", - "hosts": [ - { - "host": "mongodb-27017.sock", - "port": null, - "type": "hostname" - }, - { - "host": "rel/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://mongodb-27017.sock,rel%2Fmongodb-27018.sock", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin", - "password": "foo", - "username": "alice" - }, - "description": "Unix domain socket with auth database (relative path)", - "hosts": [ - { - "host": "rel/mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://alice:foo@rel%2Fmongodb-27017.sock/admin", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Unix domain socket with path resembling socket file (relative path with trailing slash)", - "hosts": [ - { - "host": "rel/path.to.sock/mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://rel%2Fpath.to.sock%2Fmongodb-27017.sock/", - "valid": true, - "warning": false - }, - { - "auth": null, - "description": "Unix domain socket with path resembling socket file (relative path without trailing slash)", - "hosts": [ - { - "host": "rel/path.to.sock/mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://rel%2Fpath.to.sock%2Fmongodb-27017.sock", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin", - "password": "bar", - "username": "bob" - }, - "description": "Unix domain socket with path resembling socket file and auth (relative path)", - "hosts": [ - { - "host": "rel/path.to.sock/mongodb-27017.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://bob:bar@rel%2Fpath.to.sock%2Fmongodb-27017.sock/admin", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin", - "password": null, - "username": null - }, - "description": "Multiple Unix domain sockets and auth DB resembling a socket (relative path)", - "hosts": [ - { - "host": "rel/mongodb-27017.sock", - "port": null, - "type": "unix" - }, - { - "host": "rel/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://rel%2Fmongodb-27017.sock,rel%2Fmongodb-27018.sock/admin", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin", - "password": null, - "username": null - }, - "description": "Multiple Unix domain sockets with auth DB resembling a path (relative path)", - "hosts": [ - { - "host": "rel/mongodb-27017.sock", - "port": null, - "type": "unix" - }, - { - "host": "rel/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": null, - "uri": "mongodb://rel%2Fmongodb-27017.sock,rel%2Fmongodb-27018.sock/admin", - "valid": true, - "warning": false - }, - { - "auth": { - "db": "admin", - "password": "bar", - "username": "bob" - }, - "description": "Multiple Unix domain sockets with auth and query string (relative path)", - "hosts": [ - { - "host": "rel/mongodb-27017.sock", - "port": null, - "type": "unix" - }, - { - "host": "rel/mongodb-27018.sock", - "port": null, - "type": "unix" - } - ], - "options": { - "w": 1 - }, - "uri": "mongodb://bob:bar@rel%2Fmongodb-27017.sock,rel%2Fmongodb-27018.sock/admin?w=1", - "valid": true, - "warning": false + "type": "unix", + "host": "rel/mongodb-27017.sock", + "port": null } - ] + ], + "auth": null, + "options": null + }, + { + "description": "Unix domain socket (relative path without trailing slash)", + "uri": "mongodb://rel%2Fmongodb-27017.sock", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "rel/mongodb-27017.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Unix domain socket (relative path with spaces)", + "uri": "mongodb://rel%2F %2Fmongodb-27017.sock", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "rel/ /mongodb-27017.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Multiple Unix domain sockets (relative paths)", + "uri": "mongodb://rel%2Fmongodb-27017.sock,rel%2Fmongodb-27018.sock", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "rel/mongodb-27017.sock", + "port": null + }, + { + "type": "unix", + "host": "rel/mongodb-27018.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Multiple Unix domain sockets (relative and absolute paths)", + "uri": "mongodb://rel%2Fmongodb-27017.sock,%2Ftmp%2Fmongodb-27018.sock", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "rel/mongodb-27017.sock", + "port": null + }, + { + "type": "unix", + "host": "/tmp/mongodb-27018.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Multiple hosts (relative path and ipv4)", + "uri": "mongodb://127.0.0.1:27017,rel%2Fmongodb-27017.sock", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "ipv4", + "host": "127.0.0.1", + "port": 27017 + }, + { + "type": "unix", + "host": "rel/mongodb-27017.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Multiple hosts (relative path and hostname resembling relative path)", + "uri": "mongodb://mongodb-27017.sock,rel%2Fmongodb-27018.sock", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "hostname", + "host": "mongodb-27017.sock", + "port": null + }, + { + "type": "unix", + "host": "rel/mongodb-27018.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Unix domain socket with auth database (relative path)", + "uri": "mongodb://alice:foo@rel%2Fmongodb-27017.sock/admin", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "rel/mongodb-27017.sock", + "port": null + } + ], + "auth": { + "username": "alice", + "password": "foo", + "db": "admin" + }, + "options": null + }, + { + "description": "Unix domain socket with path resembling socket file (relative path with trailing slash)", + "uri": "mongodb://rel%2Fpath.to.sock%2Fmongodb-27017.sock/", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "rel/path.to.sock/mongodb-27017.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Unix domain socket with path resembling socket file (relative path without trailing slash)", + "uri": "mongodb://rel%2Fpath.to.sock%2Fmongodb-27017.sock", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "rel/path.to.sock/mongodb-27017.sock", + "port": null + } + ], + "auth": null, + "options": null + }, + { + "description": "Unix domain socket with path resembling socket file and auth (relative path)", + "uri": "mongodb://bob:bar@rel%2Fpath.to.sock%2Fmongodb-27017.sock/admin", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "rel/path.to.sock/mongodb-27017.sock", + "port": null + } + ], + "auth": { + "username": "bob", + "password": "bar", + "db": "admin" + }, + "options": null + }, + { + "description": "Multiple Unix domain sockets and auth DB resembling a socket (relative path)", + "uri": "mongodb://rel%2Fmongodb-27017.sock,rel%2Fmongodb-27018.sock/admin", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "rel/mongodb-27017.sock", + "port": null + }, + { + "type": "unix", + "host": "rel/mongodb-27018.sock", + "port": null + } + ], + "auth": { + "username": null, + "password": null, + "db": "admin" + }, + "options": null + }, + { + "description": "Multiple Unix domain sockets with auth DB resembling a path (relative path)", + "uri": "mongodb://rel%2Fmongodb-27017.sock,rel%2Fmongodb-27018.sock/admin", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "rel/mongodb-27017.sock", + "port": null + }, + { + "type": "unix", + "host": "rel/mongodb-27018.sock", + "port": null + } + ], + "auth": { + "username": null, + "password": null, + "db": "admin" + }, + "options": null + }, + { + "description": "Multiple Unix domain sockets with auth and query string (relative path)", + "uri": "mongodb://bob:bar@rel%2Fmongodb-27017.sock,rel%2Fmongodb-27018.sock/admin?w=1", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "unix", + "host": "rel/mongodb-27017.sock", + "port": null + }, + { + "type": "unix", + "host": "rel/mongodb-27018.sock", + "port": null + } + ], + "auth": { + "username": "bob", + "password": "bar", + "db": "admin" + }, + "options": { + "w": 1 + } + } + ] } diff --git a/test/connection_string/test/valid-warnings.json b/test/connection_string/test/valid-warnings.json index 6775fae98..87f7248f2 100644 --- a/test/connection_string/test/valid-warnings.json +++ b/test/connection_string/test/valid-warnings.json @@ -65,4 +65,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/read/aggregate-collation.json b/test/crud/read/aggregate-collation.json index 903a5834e..85662a442 100644 --- a/test/crud/read/aggregate-collation.json +++ b/test/crud/read/aggregate-collation.json @@ -35,4 +35,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/read/aggregate-out.json b/test/crud/read/aggregate-out.json index cbc8ca47b..fd890e537 100644 --- a/test/crud/read/aggregate-out.json +++ b/test/crud/read/aggregate-out.json @@ -67,4 +67,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/read/aggregate.json b/test/crud/read/aggregate.json index 479fcb9b7..797a92239 100644 --- a/test/crud/read/aggregate.json +++ b/test/crud/read/aggregate.json @@ -50,4 +50,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/read/count-collation.json b/test/crud/read/count-collation.json index 462120942..6ea9ab81c 100644 --- a/test/crud/read/count-collation.json +++ b/test/crud/read/count-collation.json @@ -26,4 +26,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/read/count.json b/test/crud/read/count.json index 85c17e11a..5020771d1 100644 --- a/test/crud/read/count.json +++ b/test/crud/read/count.json @@ -57,4 +57,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/read/distinct-collation.json b/test/crud/read/distinct-collation.json index 4d688cc3d..0af0c67cb 100644 --- a/test/crud/read/distinct-collation.json +++ b/test/crud/read/distinct-collation.json @@ -30,4 +30,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/read/distinct.json b/test/crud/read/distinct.json index 408d8a480..a57ee36a8 100644 --- a/test/crud/read/distinct.json +++ b/test/crud/read/distinct.json @@ -52,4 +52,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/read/find-collation.json b/test/crud/read/find-collation.json index b2d268ae3..53d0e9490 100644 --- a/test/crud/read/find-collation.json +++ b/test/crud/read/find-collation.json @@ -31,4 +31,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/read/find.json b/test/crud/read/find.json index d92081d55..3597e37be 100644 --- a/test/crud/read/find.json +++ b/test/crud/read/find.json @@ -102,4 +102,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/deleteMany-collation.json b/test/crud/write/deleteMany-collation.json index 593ad6856..d17bf3bcb 100644 --- a/test/crud/write/deleteMany-collation.json +++ b/test/crud/write/deleteMany-collation.json @@ -44,4 +44,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/deleteMany.json b/test/crud/write/deleteMany.json index 885ebd200..7eee85e77 100644 --- a/test/crud/write/deleteMany.json +++ b/test/crud/write/deleteMany.json @@ -73,4 +73,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/deleteOne-collation.json b/test/crud/write/deleteOne-collation.json index 9f22b1124..2f7f92113 100644 --- a/test/crud/write/deleteOne-collation.json +++ b/test/crud/write/deleteOne-collation.json @@ -48,4 +48,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/deleteOne.json b/test/crud/write/deleteOne.json index 50226bdd5..a1106deae 100644 --- a/test/crud/write/deleteOne.json +++ b/test/crud/write/deleteOne.json @@ -93,4 +93,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/findOneAndDelete-collation.json b/test/crud/write/findOneAndDelete-collation.json index e848d754d..1ff37d2e8 100644 --- a/test/crud/write/findOneAndDelete-collation.json +++ b/test/crud/write/findOneAndDelete-collation.json @@ -56,4 +56,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/findOneAndDelete.json b/test/crud/write/findOneAndDelete.json index 2bfcc32c6..e424e2aad 100644 --- a/test/crud/write/findOneAndDelete.json +++ b/test/crud/write/findOneAndDelete.json @@ -124,4 +124,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/findOneAndReplace-collation.json b/test/crud/write/findOneAndReplace-collation.json index 5227b0f8f..babb2f7c1 100644 --- a/test/crud/write/findOneAndReplace-collation.json +++ b/test/crud/write/findOneAndReplace-collation.json @@ -55,4 +55,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/findOneAndReplace-upsert.json b/test/crud/write/findOneAndReplace-upsert.json index e13eb9c2b..0f07bf9c1 100644 --- a/test/crud/write/findOneAndReplace-upsert.json +++ b/test/crud/write/findOneAndReplace-upsert.json @@ -198,4 +198,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/findOneAndReplace-upsert_pre_2.6.json b/test/crud/write/findOneAndReplace-upsert_pre_2.6.json index 613c664bf..93b1c70ed 100644 --- a/test/crud/write/findOneAndReplace-upsert_pre_2.6.json +++ b/test/crud/write/findOneAndReplace-upsert_pre_2.6.json @@ -158,4 +158,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/findOneAndReplace.json b/test/crud/write/findOneAndReplace.json index f8eb5ebb6..70e5c3df4 100644 --- a/test/crud/write/findOneAndReplace.json +++ b/test/crud/write/findOneAndReplace.json @@ -270,4 +270,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/findOneAndUpdate-arrayFilters.json b/test/crud/write/findOneAndUpdate-arrayFilters.json new file mode 100644 index 000000000..192dd90d1 --- /dev/null +++ b/test/crud/write/findOneAndUpdate-arrayFilters.json @@ -0,0 +1,203 @@ +{ + "data": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + } + ], + "minServerVersion": "3.6", + "tests": [ + { + "description": "FindOneAndUpdate when no document matches arrayFilters", + "operation": { + "name": "findOneAndUpdate", + "arguments": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 4 + } + ] + } + }, + "outcome": { + "result": { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + "collection": { + "data": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + } + ] + } + } + }, + { + "description": "FindOneAndUpdate when one document matches arrayFilters", + "operation": { + "name": "findOneAndUpdate", + "arguments": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 3 + } + ] + } + }, + "outcome": { + "result": { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + "collection": { + "data": [ + { + "_id": 1, + "y": [ + { + "b": 2 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + } + ] + } + } + }, + { + "description": "FindOneAndUpdate when multiple documents match arrayFilters", + "operation": { + "name": "findOneAndUpdate", + "arguments": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 1 + } + ] + } + }, + "outcome": { + "result": { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + "collection": { + "data": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 2 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + } + ] + } + } + } + ] +} diff --git a/test/crud/write/findOneAndUpdate-collation.json b/test/crud/write/findOneAndUpdate-collation.json index 172149ac8..04c1fe73e 100644 --- a/test/crud/write/findOneAndUpdate-collation.json +++ b/test/crud/write/findOneAndUpdate-collation.json @@ -64,4 +64,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/findOneAndUpdate.json b/test/crud/write/findOneAndUpdate.json index c257b7402..6da832527 100644 --- a/test/crud/write/findOneAndUpdate.json +++ b/test/crud/write/findOneAndUpdate.json @@ -376,4 +376,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/insertMany.json b/test/crud/write/insertMany.json index f604ef75f..61c88eecc 100644 --- a/test/crud/write/insertMany.json +++ b/test/crud/write/insertMany.json @@ -49,4 +49,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/insertOne.json b/test/crud/write/insertOne.json index 83597fca8..525de75e0 100644 --- a/test/crud/write/insertOne.json +++ b/test/crud/write/insertOne.json @@ -36,4 +36,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/replaceOne-collation.json b/test/crud/write/replaceOne-collation.json index c2a08c9b1..a668fe738 100644 --- a/test/crud/write/replaceOne-collation.json +++ b/test/crud/write/replaceOne-collation.json @@ -50,4 +50,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/replaceOne-pre_2.6.json b/test/crud/write/replaceOne-pre_2.6.json index 363bad50b..79a449adb 100644 --- a/test/crud/write/replaceOne-pre_2.6.json +++ b/test/crud/write/replaceOne-pre_2.6.json @@ -176,4 +176,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/replaceOne.json b/test/crud/write/replaceOne.json index 580e3b939..101af25c7 100644 --- a/test/crud/write/replaceOne.json +++ b/test/crud/write/replaceOne.json @@ -202,4 +202,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/updateMany-arrayFilters.json b/test/crud/write/updateMany-arrayFilters.json new file mode 100644 index 000000000..bd3382b00 --- /dev/null +++ b/test/crud/write/updateMany-arrayFilters.json @@ -0,0 +1,182 @@ +{ + "data": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + } + ], + "minServerVersion": "3.6", + "tests": [ + { + "description": "UpdateMany when no documents match arrayFilters", + "operation": { + "name": "updateMany", + "arguments": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 4 + } + ] + } + }, + "outcome": { + "result": { + "matchedCount": 2, + "modifiedCount": 0 + }, + "collection": { + "data": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + } + ] + } + } + }, + { + "description": "UpdateMany when one document matches arrayFilters", + "operation": { + "name": "updateMany", + "arguments": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 3 + } + ] + } + }, + "outcome": { + "result": { + "matchedCount": 2, + "modifiedCount": 1 + }, + "collection": { + "data": [ + { + "_id": 1, + "y": [ + { + "b": 2 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + } + ] + } + } + }, + { + "description": "UpdateMany when multiple documents match arrayFilters", + "operation": { + "name": "updateMany", + "arguments": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 1 + } + ] + } + }, + "outcome": { + "result": { + "matchedCount": 2, + "modifiedCount": 2 + }, + "collection": { + "data": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 2 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 2 + } + ] + } + ] + } + } + } + ] +} diff --git a/test/crud/write/updateMany-collation.json b/test/crud/write/updateMany-collation.json index d88ce60fc..3cb49f229 100644 --- a/test/crud/write/updateMany-collation.json +++ b/test/crud/write/updateMany-collation.json @@ -59,4 +59,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/updateMany-pre_2.6.json b/test/crud/write/updateMany-pre_2.6.json index 89e8a5c91..8b399316d 100644 --- a/test/crud/write/updateMany-pre_2.6.json +++ b/test/crud/write/updateMany-pre_2.6.json @@ -176,4 +176,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/updateMany.json b/test/crud/write/updateMany.json index 533e3f308..a3c339987 100644 --- a/test/crud/write/updateMany.json +++ b/test/crud/write/updateMany.json @@ -180,4 +180,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/updateOne-arrayFilters.json b/test/crud/write/updateOne-arrayFilters.json new file mode 100644 index 000000000..fea7a001c --- /dev/null +++ b/test/crud/write/updateOne-arrayFilters.json @@ -0,0 +1,390 @@ +{ + "data": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + }, + { + "_id": 3, + "y": [ + { + "b": 5, + "c": [ + { + "d": 2 + }, + { + "d": 1 + } + ] + } + ] + } + ], + "minServerVersion": "3.6", + "tests": [ + { + "description": "UpdateOne when no document matches arrayFilters", + "operation": { + "name": "updateOne", + "arguments": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 4 + } + ] + } + }, + "outcome": { + "result": { + "matchedCount": 1, + "modifiedCount": 0 + }, + "collection": { + "data": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + }, + { + "_id": 3, + "y": [ + { + "b": 5, + "c": [ + { + "d": 2 + }, + { + "d": 1 + } + ] + } + ] + } + ] + } + } + }, + { + "description": "UpdateOne when one document matches arrayFilters", + "operation": { + "name": "updateOne", + "arguments": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 3 + } + ] + } + }, + "outcome": { + "result": { + "matchedCount": 1, + "modifiedCount": 1 + }, + "collection": { + "data": [ + { + "_id": 1, + "y": [ + { + "b": 2 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + }, + { + "_id": 3, + "y": [ + { + "b": 5, + "c": [ + { + "d": 2 + }, + { + "d": 1 + } + ] + } + ] + } + ] + } + } + }, + { + "description": "UpdateOne when multiple documents match arrayFilters", + "operation": { + "name": "updateOne", + "arguments": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 1 + } + ] + } + }, + "outcome": { + "result": { + "matchedCount": 1, + "modifiedCount": 1 + }, + "collection": { + "data": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 2 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + }, + { + "_id": 3, + "y": [ + { + "b": 5, + "c": [ + { + "d": 2 + }, + { + "d": 1 + } + ] + } + ] + } + ] + } + } + }, + { + "description": "UpdateOne when no documents match multiple arrayFilters", + "operation": { + "name": "updateOne", + "arguments": { + "filter": { + "_id": 3 + }, + "update": { + "$set": { + "y.$[i].c.$[j].d": 0 + } + }, + "arrayFilters": [ + { + "i.b": 5 + }, + { + "j.d": 3 + } + ] + } + }, + "outcome": { + "result": { + "matchedCount": 1, + "modifiedCount": 0 + }, + "collection": { + "data": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + }, + { + "_id": 3, + "y": [ + { + "b": 5, + "c": [ + { + "d": 2 + }, + { + "d": 1 + } + ] + } + ] + } + ] + } + } + }, + { + "description": "UpdateOne when one document matches multiple arrayFilters", + "operation": { + "name": "updateOne", + "arguments": { + "filter": { + "_id": 3 + }, + "update": { + "$set": { + "y.$[i].c.$[j].d": 0 + } + }, + "arrayFilters": [ + { + "i.b": 5 + }, + { + "j.d": 1 + } + ] + } + }, + "outcome": { + "result": { + "matchedCount": 1, + "modifiedCount": 1 + }, + "collection": { + "data": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + }, + { + "_id": 3, + "y": [ + { + "b": 5, + "c": [ + { + "d": 2 + }, + { + "d": 0 + } + ] + } + ] + } + ] + } + } + } + ] +} diff --git a/test/crud/write/updateOne-collation.json b/test/crud/write/updateOne-collation.json index 8e45ff328..c49112d51 100644 --- a/test/crud/write/updateOne-collation.json +++ b/test/crud/write/updateOne-collation.json @@ -51,4 +51,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/updateOne-pre_2.6.json b/test/crud/write/updateOne-pre_2.6.json index de15c6162..0055b33c8 100644 --- a/test/crud/write/updateOne-pre_2.6.json +++ b/test/crud/write/updateOne-pre_2.6.json @@ -160,4 +160,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/crud/write/updateOne.json b/test/crud/write/updateOne.json index 1a51dff13..76d2086bd 100644 --- a/test/crud/write/updateOne.json +++ b/test/crud/write/updateOne.json @@ -164,4 +164,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/discovery_and_monitoring/rs/discover_arbiters.json b/test/discovery_and_monitoring/rs/discover_arbiters.json index 42c8e087c..ced7baeb6 100644 --- a/test/discovery_and_monitoring/rs/discover_arbiters.json +++ b/test/discovery_and_monitoring/rs/discover_arbiters.json @@ -15,7 +15,9 @@ "arbiters": [ "b:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/discover_passives.json b/test/discovery_and_monitoring/rs/discover_passives.json index cbd17211c..e46249d66 100644 --- a/test/discovery_and_monitoring/rs/discover_passives.json +++ b/test/discovery_and_monitoring/rs/discover_passives.json @@ -15,7 +15,9 @@ "passives": [ "b:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -50,7 +52,9 @@ "passives": [ "b:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/discover_primary.json b/test/discovery_and_monitoring/rs/discover_primary.json index e27167392..ea2cce9b7 100644 --- a/test/discovery_and_monitoring/rs/discover_primary.json +++ b/test/discovery_and_monitoring/rs/discover_primary.json @@ -13,7 +13,9 @@ "hosts": [ "a:27017", "b:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/discover_secondary.json b/test/discovery_and_monitoring/rs/discover_secondary.json index 671421d4a..7210b3845 100644 --- a/test/discovery_and_monitoring/rs/discover_secondary.json +++ b/test/discovery_and_monitoring/rs/discover_secondary.json @@ -14,7 +14,9 @@ "hosts": [ "a:27017", "b:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/discovery.json b/test/discovery_and_monitoring/rs/discovery.json index 92270277a..57ed568e3 100644 --- a/test/discovery_and_monitoring/rs/discovery.json +++ b/test/discovery_and_monitoring/rs/discovery.json @@ -15,7 +15,9 @@ "a:27017", "b:27017", "c:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -53,7 +55,9 @@ "b:27017", "c:27017", "d:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -94,7 +98,9 @@ "c:27017", "d:27017", "e:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -135,7 +141,9 @@ "a:27017", "b:27017", "c:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/equal_electionids.json b/test/discovery_and_monitoring/rs/equal_electionids.json index 7c049fe6a..8a5aa8cd6 100644 --- a/test/discovery_and_monitoring/rs/equal_electionids.json +++ b/test/discovery_and_monitoring/rs/equal_electionids.json @@ -17,7 +17,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000001" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ], [ @@ -33,7 +35,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000001" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/ghost_discovered.json b/test/discovery_and_monitoring/rs/ghost_discovered.json index 3e24f2e4e..bf22cbb0e 100644 --- a/test/discovery_and_monitoring/rs/ghost_discovered.json +++ b/test/discovery_and_monitoring/rs/ghost_discovered.json @@ -9,7 +9,9 @@ { "ok": 1, "ismaster": false, - "isreplicaset": true + "isreplicaset": true, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/hosts_differ_from_seeds.json b/test/discovery_and_monitoring/rs/hosts_differ_from_seeds.json index 7eb22dc4a..a67db57d0 100644 --- a/test/discovery_and_monitoring/rs/hosts_differ_from_seeds.json +++ b/test/discovery_and_monitoring/rs/hosts_differ_from_seeds.json @@ -12,7 +12,9 @@ "setName": "rs", "hosts": [ "b:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/ls_timeout.json b/test/discovery_and_monitoring/rs/ls_timeout.json index b525a0dbd..686c3ab38 100644 --- a/test/discovery_and_monitoring/rs/ls_timeout.json +++ b/test/discovery_and_monitoring/rs/ls_timeout.json @@ -14,7 +14,9 @@ "b:27017" ], "setName": "rs", - "localLogicalSessionTimeoutMinutes": 1 + "localLogicalSessionTimeoutMinutes": 1, + "minWireVersion": 0, + "maxWireVersion": 6 } ], [ @@ -28,7 +30,9 @@ "b:27017" ], "setName": "rs", - "localLogicalSessionTimeoutMinutes": 2 + "localLogicalSessionTimeoutMinutes": 2, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -60,7 +64,9 @@ "b:27017" ], "setName": "rs", - "localLogicalSessionTimeoutMinutes": 1 + "localLogicalSessionTimeoutMinutes": 1, + "minWireVersion": 0, + "maxWireVersion": 6 } ], [ @@ -74,7 +80,9 @@ "b:27017" ], "setName": "rs", - "localLogicalSessionTimeoutMinutes": null + "localLogicalSessionTimeoutMinutes": null, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/member_reconfig.json b/test/discovery_and_monitoring/rs/member_reconfig.json index 56125e9dd..336acff02 100644 --- a/test/discovery_and_monitoring/rs/member_reconfig.json +++ b/test/discovery_and_monitoring/rs/member_reconfig.json @@ -13,7 +13,9 @@ "hosts": [ "a:27017", "b:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -43,7 +45,9 @@ "setName": "rs", "hosts": [ "a:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/member_standalone.json b/test/discovery_and_monitoring/rs/member_standalone.json index 280bc895a..a97dfabf5 100644 --- a/test/discovery_and_monitoring/rs/member_standalone.json +++ b/test/discovery_and_monitoring/rs/member_standalone.json @@ -8,7 +8,9 @@ "b:27017", { "ok": 1, - "ismaster": true + "ismaster": true, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -34,7 +36,9 @@ "setName": "rs", "hosts": [ "a:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/new_primary.json b/test/discovery_and_monitoring/rs/new_primary.json index 4ada619a3..eb73b304b 100644 --- a/test/discovery_and_monitoring/rs/new_primary.json +++ b/test/discovery_and_monitoring/rs/new_primary.json @@ -13,7 +13,9 @@ "hosts": [ "a:27017", "b:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -44,7 +46,9 @@ "hosts": [ "a:27017", "b:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/new_primary_new_electionid.json b/test/discovery_and_monitoring/rs/new_primary_new_electionid.json index f9860b501..cd6c37cef 100644 --- a/test/discovery_and_monitoring/rs/new_primary_new_electionid.json +++ b/test/discovery_and_monitoring/rs/new_primary_new_electionid.json @@ -17,7 +17,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000001" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -57,7 +59,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000002" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -97,7 +101,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000001" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/new_primary_new_setversion.json b/test/discovery_and_monitoring/rs/new_primary_new_setversion.json index b8560b648..c5828171d 100644 --- a/test/discovery_and_monitoring/rs/new_primary_new_setversion.json +++ b/test/discovery_and_monitoring/rs/new_primary_new_setversion.json @@ -17,7 +17,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000001" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -57,7 +59,9 @@ "setVersion": 2, "electionId": { "$oid": "000000000000000000000001" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -97,7 +101,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000001" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/new_primary_wrong_set_name.json b/test/discovery_and_monitoring/rs/new_primary_wrong_set_name.json index 428ac35d9..7be79d2d3 100644 --- a/test/discovery_and_monitoring/rs/new_primary_wrong_set_name.json +++ b/test/discovery_and_monitoring/rs/new_primary_wrong_set_name.json @@ -13,7 +13,9 @@ "a:27017", "b:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -43,7 +45,9 @@ "hosts": [ "a:27017" ], - "setName": "wrong" + "setName": "wrong", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/non_rs_member.json b/test/discovery_and_monitoring/rs/non_rs_member.json index ed577ce7e..907c1651e 100644 --- a/test/discovery_and_monitoring/rs/non_rs_member.json +++ b/test/discovery_and_monitoring/rs/non_rs_member.json @@ -7,7 +7,9 @@ [ "b:27017", { - "ok": 1 + "ok": 1, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/normalize_case.json b/test/discovery_and_monitoring/rs/normalize_case.json index d4ff6ab8c..4d0b0ae62 100644 --- a/test/discovery_and_monitoring/rs/normalize_case.json +++ b/test/discovery_and_monitoring/rs/normalize_case.json @@ -18,7 +18,9 @@ ], "arbiters": [ "C:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/null_election_id.json b/test/discovery_and_monitoring/rs/null_election_id.json index 87b769591..d4348df44 100644 --- a/test/discovery_and_monitoring/rs/null_election_id.json +++ b/test/discovery_and_monitoring/rs/null_election_id.json @@ -15,7 +15,9 @@ "c:27017" ], "setVersion": 1, - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -59,7 +61,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000002" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -102,7 +106,9 @@ "c:27017" ], "setVersion": 1, - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -146,7 +152,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000001" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/primary_becomes_standalone.json b/test/discovery_and_monitoring/rs/primary_becomes_standalone.json index b40d9a078..e35c75f4b 100644 --- a/test/discovery_and_monitoring/rs/primary_becomes_standalone.json +++ b/test/discovery_and_monitoring/rs/primary_becomes_standalone.json @@ -12,7 +12,9 @@ "hosts": [ "a:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -33,7 +35,9 @@ [ "a:27017", { - "ok": 1 + "ok": 1, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/primary_changes_set_name.json b/test/discovery_and_monitoring/rs/primary_changes_set_name.json index c214124ae..d00832612 100644 --- a/test/discovery_and_monitoring/rs/primary_changes_set_name.json +++ b/test/discovery_and_monitoring/rs/primary_changes_set_name.json @@ -12,7 +12,9 @@ "hosts": [ "a:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -38,7 +40,9 @@ "hosts": [ "a:27017" ], - "setName": "wrong" + "setName": "wrong", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/primary_disconnect.json b/test/discovery_and_monitoring/rs/primary_disconnect.json index 2df53fa79..271ca5874 100644 --- a/test/discovery_and_monitoring/rs/primary_disconnect.json +++ b/test/discovery_and_monitoring/rs/primary_disconnect.json @@ -12,7 +12,9 @@ "hosts": [ "a:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/primary_disconnect_electionid.json b/test/discovery_and_monitoring/rs/primary_disconnect_electionid.json index 69f9cfd18..e81f29908 100644 --- a/test/discovery_and_monitoring/rs/primary_disconnect_electionid.json +++ b/test/discovery_and_monitoring/rs/primary_disconnect_electionid.json @@ -17,7 +17,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000001" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ], [ @@ -33,7 +35,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000002" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -98,7 +102,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000001" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -135,7 +141,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000003" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -172,7 +180,9 @@ "a:27017", "b:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/primary_disconnect_setversion.json b/test/discovery_and_monitoring/rs/primary_disconnect_setversion.json index a04ef46fa..d0e55c545 100644 --- a/test/discovery_and_monitoring/rs/primary_disconnect_setversion.json +++ b/test/discovery_and_monitoring/rs/primary_disconnect_setversion.json @@ -17,7 +17,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000001" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ], [ @@ -33,7 +35,9 @@ "setVersion": 2, "electionId": { "$oid": "000000000000000000000001" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -98,7 +102,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000001" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -135,7 +141,9 @@ "setVersion": 2, "electionId": { "$oid": "000000000000000000000002" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -172,7 +180,9 @@ "a:27017", "b:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/primary_hint_from_secondary_with_mismatched_me.json b/test/discovery_and_monitoring/rs/primary_hint_from_secondary_with_mismatched_me.json index ace569317..806fda37c 100644 --- a/test/discovery_and_monitoring/rs/primary_hint_from_secondary_with_mismatched_me.json +++ b/test/discovery_and_monitoring/rs/primary_hint_from_secondary_with_mismatched_me.json @@ -15,7 +15,9 @@ "b:27017" ], "setName": "rs", - "primary": "b:27017" + "primary": "b:27017", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -42,7 +44,9 @@ "hosts": [ "b:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/primary_reports_new_member.json b/test/discovery_and_monitoring/rs/primary_reports_new_member.json index d0a5c998c..6ed55ab3d 100644 --- a/test/discovery_and_monitoring/rs/primary_reports_new_member.json +++ b/test/discovery_and_monitoring/rs/primary_reports_new_member.json @@ -14,7 +14,9 @@ "hosts": [ "a:27017", "b:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -45,7 +47,9 @@ "hosts": [ "a:27017", "b:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -77,7 +81,9 @@ "a:27017", "b:27017", "c:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -115,7 +121,9 @@ "a:27017", "b:27017", "c:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/primary_to_no_primary_mismatched_me.json b/test/discovery_and_monitoring/rs/primary_to_no_primary_mismatched_me.json index c9fcd6cde..fdb250ffe 100644 --- a/test/discovery_and_monitoring/rs/primary_to_no_primary_mismatched_me.json +++ b/test/discovery_and_monitoring/rs/primary_to_no_primary_mismatched_me.json @@ -14,7 +14,9 @@ "b:27017" ], "me": "a:27017", - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -46,7 +48,9 @@ "d:27017" ], "me": "c:27017", - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/primary_wrong_set_name.json b/test/discovery_and_monitoring/rs/primary_wrong_set_name.json index 56733ee66..eda478717 100644 --- a/test/discovery_and_monitoring/rs/primary_wrong_set_name.json +++ b/test/discovery_and_monitoring/rs/primary_wrong_set_name.json @@ -12,7 +12,9 @@ "hosts": [ "a:27017" ], - "setName": "wrong" + "setName": "wrong", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/response_from_removed.json b/test/discovery_and_monitoring/rs/response_from_removed.json index ab9daf8d9..dd3562d7f 100644 --- a/test/discovery_and_monitoring/rs/response_from_removed.json +++ b/test/discovery_and_monitoring/rs/response_from_removed.json @@ -12,7 +12,9 @@ "setName": "rs", "hosts": [ "a:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -40,7 +42,9 @@ "hosts": [ "a:27017", "b:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/rsother_discovered.json b/test/discovery_and_monitoring/rs/rsother_discovered.json index 22cb3cca8..c575501d8 100644 --- a/test/discovery_and_monitoring/rs/rsother_discovered.json +++ b/test/discovery_and_monitoring/rs/rsother_discovered.json @@ -15,7 +15,9 @@ "c:27017", "d:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ], [ @@ -28,7 +30,9 @@ "c:27017", "d:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/sec_not_auth.json b/test/discovery_and_monitoring/rs/sec_not_auth.json index 193ee2998..7d5e70003 100644 --- a/test/discovery_and_monitoring/rs/sec_not_auth.json +++ b/test/discovery_and_monitoring/rs/sec_not_auth.json @@ -13,7 +13,9 @@ "hosts": [ "a:27017", "b:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ], [ @@ -26,7 +28,9 @@ "hosts": [ "b:27017", "c:27017" - ] + ], + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/secondary_wrong_set_name.json b/test/discovery_and_monitoring/rs/secondary_wrong_set_name.json index 7229a8d7a..4c132b633 100644 --- a/test/discovery_and_monitoring/rs/secondary_wrong_set_name.json +++ b/test/discovery_and_monitoring/rs/secondary_wrong_set_name.json @@ -13,7 +13,9 @@ "hosts": [ "a:27017" ], - "setName": "wrong" + "setName": "wrong", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/secondary_wrong_set_name_with_primary.json b/test/discovery_and_monitoring/rs/secondary_wrong_set_name_with_primary.json index 09d586f95..73cbab7c5 100644 --- a/test/discovery_and_monitoring/rs/secondary_wrong_set_name_with_primary.json +++ b/test/discovery_and_monitoring/rs/secondary_wrong_set_name_with_primary.json @@ -13,7 +13,9 @@ "a:27017", "b:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -45,7 +47,9 @@ "a:27017", "b:27017" ], - "setName": "wrong" + "setName": "wrong", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/setversion_without_electionid.json b/test/discovery_and_monitoring/rs/setversion_without_electionid.json index 1dd475ccd..dbd9765d2 100644 --- a/test/discovery_and_monitoring/rs/setversion_without_electionid.json +++ b/test/discovery_and_monitoring/rs/setversion_without_electionid.json @@ -14,7 +14,9 @@ "b:27017" ], "setName": "rs", - "setVersion": 2 + "setVersion": 2, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -49,7 +51,9 @@ "b:27017" ], "setName": "rs", - "setVersion": 1 + "setVersion": 1, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/stepdown_change_set_name.json b/test/discovery_and_monitoring/rs/stepdown_change_set_name.json index fafea8f3c..39a4f532d 100644 --- a/test/discovery_and_monitoring/rs/stepdown_change_set_name.json +++ b/test/discovery_and_monitoring/rs/stepdown_change_set_name.json @@ -12,7 +12,9 @@ "hosts": [ "a:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -39,7 +41,9 @@ "hosts": [ "a:27017" ], - "setName": "wrong" + "setName": "wrong", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/unexpected_mongos.json b/test/discovery_and_monitoring/rs/unexpected_mongos.json index aa6992744..95c7aa9dc 100644 --- a/test/discovery_and_monitoring/rs/unexpected_mongos.json +++ b/test/discovery_and_monitoring/rs/unexpected_mongos.json @@ -9,7 +9,9 @@ { "ok": 1, "ismaster": true, - "msg": "isdbgrid" + "msg": "isdbgrid", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/use_setversion_without_electionid.json b/test/discovery_and_monitoring/rs/use_setversion_without_electionid.json index 4472de9cc..19e1727bf 100644 --- a/test/discovery_and_monitoring/rs/use_setversion_without_electionid.json +++ b/test/discovery_and_monitoring/rs/use_setversion_without_electionid.json @@ -17,7 +17,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000001" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -54,7 +56,9 @@ "b:27017" ], "setName": "rs", - "setVersion": 2 + "setVersion": 2, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -91,7 +95,9 @@ "setVersion": 1, "electionId": { "$oid": "000000000000000000000002" - } + }, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/rs/wrong_set_name.json b/test/discovery_and_monitoring/rs/wrong_set_name.json index 36561f62a..45be2f502 100644 --- a/test/discovery_and_monitoring/rs/wrong_set_name.json +++ b/test/discovery_and_monitoring/rs/wrong_set_name.json @@ -14,7 +14,9 @@ "b:27017", "c:27017" ], - "setName": "wrong" + "setName": "wrong", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/sharded/ls_timeout_mongos.json b/test/discovery_and_monitoring/sharded/ls_timeout_mongos.json index 3ae2ce434..c716487aa 100644 --- a/test/discovery_and_monitoring/sharded/ls_timeout_mongos.json +++ b/test/discovery_and_monitoring/sharded/ls_timeout_mongos.json @@ -10,7 +10,9 @@ "ok": 1, "ismaster": true, "msg": "isdbgrid", - "localLogicalSessionTimeoutMinutes": 1 + "localLogicalSessionTimeoutMinutes": 1, + "minWireVersion": 0, + "maxWireVersion": 6 } ], [ @@ -19,7 +21,9 @@ "ok": 1, "ismaster": true, "msg": "isdbgrid", - "localLogicalSessionTimeoutMinutes": 2 + "localLogicalSessionTimeoutMinutes": 2, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -47,7 +51,9 @@ "ok": 1, "ismaster": true, "msg": "isdbgrid", - "localLogicalSessionTimeoutMinutes": 1 + "localLogicalSessionTimeoutMinutes": 1, + "minWireVersion": 0, + "maxWireVersion": 6 } ], [ @@ -55,7 +61,9 @@ { "ok": 1, "ismaster": true, - "msg": "isdbgrid" + "msg": "isdbgrid", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/sharded/mongos_disconnect.json b/test/discovery_and_monitoring/sharded/mongos_disconnect.json index de11be3f5..04015694a 100644 --- a/test/discovery_and_monitoring/sharded/mongos_disconnect.json +++ b/test/discovery_and_monitoring/sharded/mongos_disconnect.json @@ -9,7 +9,9 @@ { "ok": 1, "ismaster": true, - "msg": "isdbgrid" + "msg": "isdbgrid", + "minWireVersion": 0, + "maxWireVersion": 6 } ], [ @@ -17,7 +19,9 @@ { "ok": 1, "ismaster": true, - "msg": "isdbgrid" + "msg": "isdbgrid", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], @@ -67,7 +71,9 @@ { "ok": 1, "ismaster": true, - "msg": "isdbgrid" + "msg": "isdbgrid", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/sharded/multiple_mongoses.json b/test/discovery_and_monitoring/sharded/multiple_mongoses.json index bea627ce5..6e60fd05c 100644 --- a/test/discovery_and_monitoring/sharded/multiple_mongoses.json +++ b/test/discovery_and_monitoring/sharded/multiple_mongoses.json @@ -9,7 +9,9 @@ { "ok": 1, "ismaster": true, - "msg": "isdbgrid" + "msg": "isdbgrid", + "minWireVersion": 0, + "maxWireVersion": 6 } ], [ @@ -17,7 +19,9 @@ { "ok": 1, "ismaster": true, - "msg": "isdbgrid" + "msg": "isdbgrid", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/sharded/non_mongos_removed.json b/test/discovery_and_monitoring/sharded/non_mongos_removed.json index d0dfee66a..58cf7c07d 100644 --- a/test/discovery_and_monitoring/sharded/non_mongos_removed.json +++ b/test/discovery_and_monitoring/sharded/non_mongos_removed.json @@ -9,7 +9,9 @@ { "ok": 1, "ismaster": true, - "msg": "isdbgrid" + "msg": "isdbgrid", + "minWireVersion": 0, + "maxWireVersion": 6 } ], [ @@ -20,7 +22,9 @@ "hosts": [ "b:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/single/direct_connection_external_ip.json b/test/discovery_and_monitoring/single/direct_connection_external_ip.json index 11feedbb5..445815018 100644 --- a/test/discovery_and_monitoring/single/direct_connection_external_ip.json +++ b/test/discovery_and_monitoring/single/direct_connection_external_ip.json @@ -12,7 +12,9 @@ "hosts": [ "b:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/single/direct_connection_mongos.json b/test/discovery_and_monitoring/single/direct_connection_mongos.json index 397af462d..a7fa07949 100644 --- a/test/discovery_and_monitoring/single/direct_connection_mongos.json +++ b/test/discovery_and_monitoring/single/direct_connection_mongos.json @@ -9,7 +9,9 @@ { "ok": 1, "ismaster": true, - "msg": "isdbgrid" + "msg": "isdbgrid", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/single/direct_connection_rsarbiter.json b/test/discovery_and_monitoring/single/direct_connection_rsarbiter.json index faf062a71..3ef374d6f 100644 --- a/test/discovery_and_monitoring/single/direct_connection_rsarbiter.json +++ b/test/discovery_and_monitoring/single/direct_connection_rsarbiter.json @@ -14,7 +14,9 @@ "a:27017", "b:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/single/direct_connection_rsprimary.json b/test/discovery_and_monitoring/single/direct_connection_rsprimary.json index 3dd22d243..bd5aaf7f0 100644 --- a/test/discovery_and_monitoring/single/direct_connection_rsprimary.json +++ b/test/discovery_and_monitoring/single/direct_connection_rsprimary.json @@ -13,7 +13,9 @@ "a:27017", "b:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/single/direct_connection_rssecondary.json b/test/discovery_and_monitoring/single/direct_connection_rssecondary.json index c80875039..3b4f3c8c5 100644 --- a/test/discovery_and_monitoring/single/direct_connection_rssecondary.json +++ b/test/discovery_and_monitoring/single/direct_connection_rssecondary.json @@ -14,7 +14,9 @@ "a:27017", "b:27017" ], - "setName": "rs" + "setName": "rs", + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/single/direct_connection_slave.json b/test/discovery_and_monitoring/single/direct_connection_slave.json index 28089fb3d..a40debd18 100644 --- a/test/discovery_and_monitoring/single/direct_connection_slave.json +++ b/test/discovery_and_monitoring/single/direct_connection_slave.json @@ -8,7 +8,9 @@ "a:27017", { "ok": 1, - "ismaster": false + "ismaster": false, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/single/direct_connection_standalone.json b/test/discovery_and_monitoring/single/direct_connection_standalone.json index eed31c9ed..2ecff9b9a 100644 --- a/test/discovery_and_monitoring/single/direct_connection_standalone.json +++ b/test/discovery_and_monitoring/single/direct_connection_standalone.json @@ -8,7 +8,9 @@ "a:27017", { "ok": 1, - "ismaster": true + "ismaster": true, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/single/ls_timeout_standalone.json b/test/discovery_and_monitoring/single/ls_timeout_standalone.json index e66791287..5278bf65b 100644 --- a/test/discovery_and_monitoring/single/ls_timeout_standalone.json +++ b/test/discovery_and_monitoring/single/ls_timeout_standalone.json @@ -9,7 +9,9 @@ { "ok": 1, "ismaster": true, - "localLogicalSessionTimeoutMinutes": 7 + "localLogicalSessionTimeoutMinutes": 7, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/single/not_ok_response.json b/test/discovery_and_monitoring/single/not_ok_response.json index 7a6a3df48..06f71305d 100644 --- a/test/discovery_and_monitoring/single/not_ok_response.json +++ b/test/discovery_and_monitoring/single/not_ok_response.json @@ -8,14 +8,18 @@ "a:27017", { "ok": 1, - "ismaster": true + "ismaster": true, + "minWireVersion": 0, + "maxWireVersion": 6 } ], [ "a:27017", { "ok": 0, - "ismaster": true + "ismaster": true, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/discovery_and_monitoring/single/standalone_removed.json b/test/discovery_and_monitoring/single/standalone_removed.json index 55c2c61c1..4c363ffff 100644 --- a/test/discovery_and_monitoring/single/standalone_removed.json +++ b/test/discovery_and_monitoring/single/standalone_removed.json @@ -8,7 +8,9 @@ "a:27017", { "ok": 1, - "ismaster": true + "ismaster": true, + "minWireVersion": 0, + "maxWireVersion": 6 } ] ], diff --git a/test/gridfs/delete.json b/test/gridfs/delete.json index cb92bc3d5..fb5de861f 100644 --- a/test/gridfs/delete.json +++ b/test/gridfs/delete.json @@ -13,11 +13,8 @@ "md5": "d41d8cd98f00b204e9800998ecf8427e", "filename": "length-0", "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } + "aliases": [], + "metadata": {} }, { "_id": { @@ -31,11 +28,8 @@ "md5": "d41d8cd98f00b204e9800998ecf8427e", "filename": "length-0-with-empty-chunk", "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } + "aliases": [], + "metadata": {} }, { "_id": { @@ -49,11 +43,8 @@ "md5": "c700ed4fdb1d27055aa3faa2c2432283", "filename": "length-2", "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } + "aliases": [], + "metadata": {} }, { "_id": { @@ -67,29 +58,8 @@ "md5": "dd254cdc958e53abaa67da9f797125f5", "filename": "length-8", "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } - }, - { - "_id": { - "$oid": "000000000000000000000005" - }, - "length": 8, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "dd254cdc958e53abaa67da9f797125f5", - "filename": "length-8-with-empty-chunk", - "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } + "aliases": [], + "metadata": {} } ], "chunks": [ @@ -140,42 +110,6 @@ "data": { "$hex": "55667788" } - }, - { - "_id": { - "$oid": "000000000000000000000005" - }, - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 0, - "data": { - "$hex": "11223344" - } - }, - { - "_id": { - "$oid": "000000000000000000000006" - }, - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 1, - "data": { - "$hex": "55667788" - } - }, - { - "_id": { - "$oid": "000000000000000000000007" - }, - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 2, - "data": { - "$hex": "" - } } ] }, @@ -293,48 +227,6 @@ ] } }, - { - "description": "Delete when length is 8 and there is one extra empty chunk", - "act": { - "operation": "delete", - "arguments": { - "id": { - "$oid": "000000000000000000000005" - } - } - }, - "assert": { - "result": "void", - "data": [ - { - "delete": "expected.files", - "deletes": [ - { - "q": { - "_id": { - "$oid": "000000000000000000000005" - } - }, - "limit": 1 - } - ] - }, - { - "delete": "expected.chunks", - "deletes": [ - { - "q": { - "files_id": { - "$oid": "000000000000000000000005" - } - }, - "limit": 0 - } - ] - } - ] - } - }, { "description": "Delete when files entry does not exist", "act": { @@ -359,7 +251,7 @@ { "q": { "_id": { - "$oid": "000000000000000000000005" + "$oid": "000000000000000000000004" } }, "limit": 1 @@ -372,7 +264,7 @@ "operation": "delete", "arguments": { "id": { - "$oid": "000000000000000000000005" + "$oid": "000000000000000000000004" } } }, @@ -385,7 +277,7 @@ { "q": { "_id": { - "$oid": "000000000000000000000005" + "$oid": "000000000000000000000004" } }, "limit": 1 @@ -398,7 +290,7 @@ { "q": { "files_id": { - "$oid": "000000000000000000000005" + "$oid": "000000000000000000000004" } }, "limit": 0 @@ -409,4 +301,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/gridfs/download.json b/test/gridfs/download.json index 3e50912a9..47f0b0cf0 100644 --- a/test/gridfs/download.json +++ b/test/gridfs/download.json @@ -13,11 +13,8 @@ "md5": "d41d8cd98f00b204e9800998ecf8427e", "filename": "length-0", "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } + "aliases": [], + "metadata": {} }, { "_id": { @@ -31,11 +28,8 @@ "md5": "d41d8cd98f00b204e9800998ecf8427e", "filename": "length-0-with-empty-chunk", "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } + "aliases": [], + "metadata": {} }, { "_id": { @@ -49,11 +43,8 @@ "md5": "c700ed4fdb1d27055aa3faa2c2432283", "filename": "length-2", "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } + "aliases": [], + "metadata": {} }, { "_id": { @@ -67,11 +58,8 @@ "md5": "dd254cdc958e53abaa67da9f797125f5", "filename": "length-8", "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } + "aliases": [], + "metadata": {} }, { "_id": { @@ -85,29 +73,8 @@ "md5": "57d83cd477bfb1ccd975ab33d827a92b", "filename": "length-10", "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } - }, - { - "_id": { - "$oid": "000000000000000000000006" - }, - "length": 12, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "6289ac1db331d1c7677a4b7e123178f9", - "filename": "length-12-with-empty-chunk", - "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } + "aliases": [], + "metadata": {} } ], "chunks": [ @@ -194,54 +161,6 @@ "data": { "$hex": "99aa" } - }, - { - "_id": { - "$oid": "000000000000000000000008" - }, - "files_id": { - "$oid": "000000000000000000000006" - }, - "n": 0, - "data": { - "$hex": "11223344" - } - }, - { - "_id": { - "$oid": "000000000000000000000009" - }, - "files_id": { - "$oid": "000000000000000000000006" - }, - "n": 1, - "data": { - "$hex": "55667788" - } - }, - { - "_id": { - "$oid": "000000000000000000000010" - }, - "files_id": { - "$oid": "000000000000000000000006" - }, - "n": 2, - "data": { - "$hex": "99aabbcc" - } - }, - { - "_id": { - "$oid": "000000000000000000000011" - }, - "files_id": { - "$oid": "000000000000000000000006" - }, - "n": 3, - "data": { - "$hex": "" - } } ] }, @@ -254,8 +173,7 @@ "id": { "$oid": "000000000000000000000001" }, - "options": { - } + "options": {} } }, "assert": { @@ -272,8 +190,7 @@ "id": { "$oid": "000000000000000000000002" }, - "options": { - } + "options": {} } }, "assert": { @@ -290,8 +207,7 @@ "id": { "$oid": "000000000000000000000003" }, - "options": { - } + "options": {} } }, "assert": { @@ -308,8 +224,7 @@ "id": { "$oid": "000000000000000000000004" }, - "options": { - } + "options": {} } }, "assert": { @@ -326,8 +241,7 @@ "id": { "$oid": "000000000000000000000005" }, - "options": { - } + "options": {} } }, "assert": { @@ -336,24 +250,6 @@ } } }, - { - "description": "Download when there are three chunks and one extra empty chunk at the end", - "act": { - "operation": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000006" - }, - "options": { - } - } - }, - "assert": { - "result": { - "$hex": "112233445566778899aabbcc" - } - } - }, { "description": "Download when files entry does not exist", "act": { @@ -362,8 +258,7 @@ "id": { "$oid": "000000000000000000000000" }, - "options": { - } + "options": {} } }, "assert": { @@ -434,41 +329,6 @@ "error": "ChunkIsMissing" } }, - { - "description": "Download when there is an extra chunk", - "arrange": { - "data": [ - { - "insert": "fs.chunks", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000012" - }, - "files_id": { - "$oid": "000000000000000000000004" - }, - "n": 2, - "data": { - "$hex": "99" - } - } - ] - } - ] - }, - "act": { - "operation": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000004" - } - } - }, - "assert": { - "error": "ExtraChunk" - } - }, { "description": "Download when an intermediate chunk is the wrong size", "arrange": { @@ -561,4 +421,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/gridfs/download_by_name.json b/test/gridfs/download_by_name.json index 7f4d46bb3..ecc8c9e2c 100644 --- a/test/gridfs/download_by_name.json +++ b/test/gridfs/download_by_name.json @@ -13,11 +13,8 @@ "md5": "47ed733b8d10be225eceba344d533586", "filename": "abc", "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } + "aliases": [], + "metadata": {} }, { "_id": { @@ -31,11 +28,8 @@ "md5": "b15835f133ff2e27c7cb28117bfae8f4", "filename": "abc", "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } + "aliases": [], + "metadata": {} }, { "_id": { @@ -49,11 +43,8 @@ "md5": "eccbc87e4b5ce2fe28308fd9f2a7baf3", "filename": "abc", "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } + "aliases": [], + "metadata": {} }, { "_id": { @@ -67,11 +58,8 @@ "md5": "f623e75af30e62bbd73d6df5b50bb7b5", "filename": "abc", "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } + "aliases": [], + "metadata": {} }, { "_id": { @@ -85,11 +73,8 @@ "md5": "4c614360da93c0a041b22e537de151eb", "filename": "abc", "contentType": "application/octet-stream", - "aliases": [ - - ], - "metadata": { - } + "aliases": [], + "metadata": {} } ], "chunks": [ @@ -252,4 +237,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/gridfs/upload.json b/test/gridfs/upload.json index 95dfd79e3..324ac49d2 100644 --- a/test/gridfs/upload.json +++ b/test/gridfs/upload.json @@ -1,11 +1,7 @@ { "data": { - "files": [ - - ], - "chunks": [ - - ] + "files": [], + "chunks": [] }, "tests": [ { @@ -388,4 +384,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/test_command_monitoring_spec.py b/test/test_command_monitoring_spec.py index 2a0868576..6551615cf 100644 --- a/test/test_command_monitoring_spec.py +++ b/test/test_command_monitoring_spec.py @@ -14,7 +14,6 @@ """Run the command monitoring spec tests.""" -import json import os import re import sys @@ -23,7 +22,7 @@ sys.path[0:0] = [""] import pymongo -from bson.json_util import object_hook +from bson import json_util from pymongo import monitoring from pymongo.errors import OperationFailure from pymongo.read_preferences import (make_read_preference, @@ -113,6 +112,9 @@ def create_test(scenario_def, test): elif name == 'find': if 'sort' in args: args['sort'] = list(args['sort'].items()) + for arg in 'skip', 'limit': + if arg in args: + args[arg] = int(args[arg]) try: # Iterate the cursor. tuple(coll.find(**args)) @@ -202,8 +204,7 @@ def create_tests(): dirname = os.path.split(dirpath)[-1] for filename in filenames: with open(os.path.join(dirpath, filename)) as scenario_stream: - scenario_def = json.load( - scenario_stream, object_hook=object_hook) + scenario_def = json_util.loads(scenario_stream.read()) assert bool(scenario_def.get('tests')), "tests cannot be empty" # Construct test from scenario. for test in scenario_def['tests']: