mongo 2.9.2 → 2.10.0.rc0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/mongo.rb +1 -0
- data/lib/mongo/auth/user/view.rb +4 -4
- data/lib/mongo/bulk_write.rb +14 -8
- data/lib/mongo/bulk_write/result.rb +1 -1
- data/lib/mongo/bulk_write/result_combiner.rb +2 -2
- data/lib/mongo/bulk_write/transformable.rb +17 -9
- data/lib/mongo/client.rb +107 -16
- data/lib/mongo/cluster.rb +47 -25
- data/lib/mongo/cluster/topology/replica_set_no_primary.rb +1 -1
- data/lib/mongo/cluster_time.rb +139 -0
- data/lib/mongo/collection.rb +84 -25
- data/lib/mongo/collection/view.rb +7 -3
- data/lib/mongo/collection/view/aggregation.rb +4 -4
- data/lib/mongo/collection/view/builder/aggregation.rb +31 -6
- data/lib/mongo/collection/view/builder/find_command.rb +4 -1
- data/lib/mongo/collection/view/builder/map_reduce.rb +4 -1
- data/lib/mongo/collection/view/change_stream.rb +54 -66
- data/lib/mongo/collection/view/iterable.rb +2 -2
- data/lib/mongo/collection/view/map_reduce.rb +6 -4
- data/lib/mongo/collection/view/readable.rb +36 -16
- data/lib/mongo/collection/view/writable.rb +68 -22
- data/lib/mongo/cursor.rb +87 -20
- data/lib/mongo/database.rb +47 -43
- data/lib/mongo/database/view.rb +54 -11
- data/lib/mongo/error.rb +13 -4
- data/lib/mongo/error/invalid_write_concern.rb +2 -2
- data/lib/mongo/error/operation_failure.rb +65 -11
- data/lib/mongo/error/parser.rb +41 -8
- data/lib/mongo/grid/fs_bucket.rb +26 -6
- data/lib/mongo/grid/stream/read.rb +9 -2
- data/lib/mongo/grid/stream/write.rb +21 -5
- data/lib/mongo/index/view.rb +3 -3
- data/lib/mongo/lint.rb +10 -3
- data/lib/mongo/operation.rb +2 -0
- data/lib/mongo/operation/aggregate/result.rb +19 -6
- data/lib/mongo/operation/collections_info.rb +1 -1
- data/lib/mongo/operation/get_more/result.rb +9 -0
- data/lib/mongo/operation/list_collections/command.rb +1 -3
- data/lib/mongo/operation/list_collections/op_msg.rb +1 -2
- data/lib/mongo/operation/parallel_scan/command.rb +4 -1
- data/lib/mongo/operation/parallel_scan/op_msg.rb +4 -1
- data/lib/mongo/operation/result.rb +27 -4
- data/lib/mongo/operation/shared/executable.rb +19 -5
- data/lib/mongo/operation/shared/executable_no_validate.rb +1 -2
- data/lib/mongo/operation/shared/executable_transaction_label.rb +0 -9
- data/lib/mongo/operation/shared/polymorphic_result.rb +9 -1
- data/lib/mongo/operation/shared/result/aggregatable.rb +2 -2
- data/lib/mongo/operation/shared/sessions_supported.rb +42 -32
- data/lib/mongo/operation/shared/specifiable.rb +40 -0
- data/lib/mongo/operation/shared/unpinnable.rb +39 -0
- data/lib/mongo/operation/shared/write.rb +1 -1
- data/lib/mongo/protocol/update.rb +6 -2
- data/lib/mongo/retryable.rb +79 -39
- data/lib/mongo/server/connection.rb +10 -3
- data/lib/mongo/server/description.rb +25 -1
- data/lib/mongo/server/monitor/connection.rb +1 -1
- data/lib/mongo/server_selector.rb +10 -0
- data/lib/mongo/server_selector/selectable.rb +172 -32
- data/lib/mongo/session.rb +654 -581
- data/lib/mongo/session/session_pool.rb +1 -1
- data/lib/mongo/socket.rb +7 -28
- data/lib/mongo/socket/ssl.rb +26 -1
- data/lib/mongo/socket/tcp.rb +3 -0
- data/lib/mongo/socket/unix.rb +3 -0
- data/lib/mongo/uri.rb +112 -265
- data/lib/mongo/uri/srv_protocol.rb +4 -1
- data/lib/mongo/version.rb +1 -1
- data/lib/mongo/write_concern.rb +10 -29
- data/lib/mongo/write_concern/acknowledged.rb +12 -0
- data/lib/mongo/write_concern/base.rb +17 -13
- data/lib/mongo/write_concern/unacknowledged.rb +12 -0
- data/spec/atlas/atlas_connectivity_spec.rb +7 -37
- data/spec/atlas/operations_spec.rb +25 -0
- data/spec/integration/change_stream_examples_spec.rb +45 -31
- data/spec/integration/change_stream_spec.rb +305 -5
- data/spec/integration/client_spec.rb +44 -0
- data/spec/integration/command_monitoring_spec.rb +1 -0
- data/spec/integration/command_spec.rb +7 -1
- data/spec/integration/mmapv1_spec.rb +28 -0
- data/spec/integration/mongos_pinning_spec.rb +34 -0
- data/spec/integration/operation_failure_code_spec.rb +2 -2
- data/spec/integration/{read_concern.rb → read_concern_spec.rb} +7 -1
- data/spec/integration/read_preference_spec.rb +485 -0
- data/spec/integration/retryable_writes_spec.rb +8 -19
- data/spec/integration/sdam_error_handling_spec.rb +1 -1
- data/spec/integration/sdam_events_spec.rb +2 -2
- data/spec/integration/server_description_spec.rb +14 -17
- data/spec/integration/server_selector_spec.rb +7 -3
- data/spec/integration/server_spec.rb +48 -0
- data/spec/integration/ssl_uri_options_spec.rb +1 -1
- data/spec/integration/step_down_spec.rb +10 -4
- data/spec/integration/transactions_examples_spec.rb +11 -10
- data/spec/lite_spec_helper.rb +19 -16
- data/spec/mongo/auth/scram/negotiation_spec.rb +11 -8
- data/spec/mongo/bulk_write/ordered_combiner_spec.rb +6 -6
- data/spec/mongo/bulk_write/unordered_combiner_spec.rb +4 -4
- data/spec/mongo/bulk_write_spec.rb +12 -2
- data/spec/mongo/client_construction_spec.rb +160 -8
- data/spec/mongo/client_spec.rb +5 -4
- data/spec/mongo/cluster_spec.rb +6 -6
- data/spec/mongo/cluster_time_spec.rb +148 -0
- data/spec/mongo/collection/view/aggregation_spec.rb +34 -15
- data/spec/mongo/collection/view/change_stream_spec.rb +62 -3
- data/spec/mongo/collection/view/map_reduce_spec.rb +7 -5
- data/spec/mongo/collection/view/readable_spec.rb +4 -4
- data/spec/mongo/collection_spec.rb +331 -14
- data/spec/mongo/cursor_spec.rb +117 -5
- data/spec/mongo/database_spec.rb +240 -8
- data/spec/mongo/error/operation_failure_spec.rb +47 -1
- data/spec/mongo/error/parser_spec.rb +160 -23
- data/spec/mongo/operation/insert/bulk_spec.rb +2 -1
- data/spec/mongo/operation/result_spec.rb +27 -0
- data/spec/mongo/operation/update/bulk_spec.rb +1 -0
- data/spec/mongo/retryable_spec.rb +2 -0
- data/spec/mongo/server/app_metadata_spec.rb +2 -2
- data/spec/mongo/server/connection_spec.rb +13 -17
- data/spec/mongo/server/monitor/connection_spec.rb +13 -10
- data/spec/mongo/server_selector_spec.rb +34 -2
- data/spec/mongo/session/session_pool_spec.rb +14 -3
- data/spec/mongo/session_spec.rb +3 -3
- data/spec/mongo/session_transaction_spec.rb +4 -3
- data/spec/mongo/socket/ssl_spec.rb +19 -5
- data/spec/mongo/socket_spec.rb +1 -62
- data/spec/mongo/uri/srv_protocol_spec.rb +14 -20
- data/spec/mongo/uri_option_parsing_spec.rb +94 -8
- data/spec/mongo/uri_spec.rb +23 -10
- data/spec/mongo/write_concern_spec.rb +56 -3
- data/spec/spec_tests/change_streams_spec.rb +2 -1
- data/spec/spec_tests/cmap_spec.rb +1 -1
- data/spec/spec_tests/crud_spec.rb +12 -2
- data/spec/spec_tests/data/change_streams/change-streams-errors.yml +24 -1
- data/spec/spec_tests/data/change_streams/change-streams.yml +172 -3
- data/spec/spec_tests/data/command_monitoring/bulkWrite.yml +1 -1
- data/spec/spec_tests/data/command_monitoring/updateMany.yml +0 -2
- data/spec/spec_tests/data/command_monitoring/updateOne.yml +0 -5
- data/spec/spec_tests/data/crud/read/aggregate-out.yml +0 -6
- data/spec/spec_tests/data/crud/read/count-empty.yml +29 -0
- data/spec/spec_tests/data/crud/write/bulkWrite-arrayFilters.yml +1 -0
- data/spec/spec_tests/data/crud/write/bulkWrite-collation.yml +101 -0
- data/spec/spec_tests/data/crud/write/bulkWrite.yml +401 -0
- data/spec/spec_tests/data/crud/write/insertMany.yml +58 -2
- data/spec/spec_tests/data/crud/write/updateMany-arrayFilters.yml +3 -0
- data/spec/spec_tests/data/crud/write/updateOne-arrayFilters.yml +6 -1
- data/spec/spec_tests/data/crud_v2/aggregate-merge.yml +103 -0
- data/spec/spec_tests/data/crud_v2/aggregate-out-readConcern.yml +110 -0
- data/spec/spec_tests/data/crud_v2/bulkWrite-arrayFilters.yml +81 -0
- data/spec/spec_tests/data/crud_v2/db-aggregate.yml +38 -0
- data/spec/spec_tests/data/crud_v2/updateWithPipelines.yml +92 -0
- data/spec/spec_tests/data/retryable_writes/insertOne-serverErrors.yml +2 -2
- data/spec/spec_tests/data/transactions/abort.yml +3 -0
- data/spec/spec_tests/data/transactions/bulk.yml +3 -8
- data/spec/spec_tests/data/transactions/causal-consistency.yml +3 -8
- data/spec/spec_tests/data/transactions/commit.yml +3 -1
- data/spec/spec_tests/data/transactions/count.yml +3 -0
- data/spec/spec_tests/data/transactions/delete.yml +3 -0
- data/spec/spec_tests/data/transactions/error-labels.yml +4 -1
- data/spec/spec_tests/data/transactions/errors-client.yml +56 -0
- data/spec/spec_tests/data/transactions/errors.yml +3 -0
- data/spec/spec_tests/data/transactions/findOneAndDelete.yml +3 -0
- data/spec/spec_tests/data/transactions/findOneAndReplace.yml +3 -0
- data/spec/spec_tests/data/transactions/findOneAndUpdate.yml +3 -0
- data/spec/spec_tests/data/transactions/insert.yml +3 -0
- data/spec/spec_tests/data/transactions/isolation.yml +3 -0
- data/spec/spec_tests/data/transactions/mongos-pin-auto.yml +1671 -0
- data/spec/spec_tests/data/transactions/mongos-recovery-token.yml +347 -0
- data/spec/spec_tests/data/transactions/pin-mongos.yml +557 -0
- data/spec/spec_tests/data/transactions/read-concern.yml +3 -0
- data/spec/spec_tests/data/transactions/read-pref.yml +3 -0
- data/spec/spec_tests/data/transactions/reads.yml +3 -0
- data/spec/spec_tests/data/transactions/retryable-abort.yml +5 -2
- data/spec/spec_tests/data/transactions/retryable-commit.yml +4 -1
- data/spec/spec_tests/data/transactions/retryable-writes.yml +3 -0
- data/spec/spec_tests/data/transactions/run-command.yml +3 -0
- data/spec/spec_tests/data/transactions/transaction-options.yml +6 -0
- data/spec/spec_tests/data/transactions/update.yml +3 -8
- data/spec/spec_tests/data/transactions/write-concern.yml +348 -38
- data/spec/spec_tests/data/transactions_api/callback-aborts.yml +6 -0
- data/spec/spec_tests/data/transactions_api/callback-commits.yml +5 -0
- data/spec/spec_tests/data/transactions_api/callback-retry.yml +7 -2
- data/spec/spec_tests/data/transactions_api/commit-retry.yml +70 -15
- data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror-4.2.yml +3 -0
- data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror.yml +3 -0
- data/spec/spec_tests/data/transactions_api/commit-writeconcernerror.yml +59 -109
- data/spec/spec_tests/data/transactions_api/commit.yml +5 -0
- data/spec/spec_tests/data/transactions_api/transaction-options.yml +10 -0
- data/spec/spec_tests/retryable_reads_spec.rb +5 -2
- data/spec/spec_tests/retryable_writes_spec.rb +5 -2
- data/spec/spec_tests/sdam_monitoring_spec.rb +3 -3
- data/spec/spec_tests/sdam_spec.rb +2 -2
- data/spec/spec_tests/transactions_api_spec.rb +1 -67
- data/spec/spec_tests/transactions_spec.rb +2 -66
- data/spec/support/authorization.rb +4 -0
- data/spec/support/change_streams.rb +30 -10
- data/spec/support/change_streams/operation.rb +27 -0
- data/spec/support/client_registry.rb +44 -25
- data/spec/support/cluster_config.rb +25 -14
- data/spec/support/cluster_tools.rb +32 -10
- data/spec/support/command_monitoring.rb +1 -1
- data/spec/support/common_shortcuts.rb +30 -0
- data/spec/support/connection_string.rb +8 -3
- data/spec/support/constraints.rb +34 -0
- data/spec/support/crud.rb +31 -16
- data/spec/support/crud/context.rb +23 -0
- data/spec/support/crud/operation.rb +311 -14
- data/spec/support/crud/spec.rb +2 -1
- data/spec/support/crud/test.rb +24 -27
- data/spec/support/crud/test_base.rb +22 -0
- data/spec/support/crud/verifier.rb +15 -1
- data/spec/support/event_subscriber.rb +12 -0
- data/spec/support/sdam_formatter_integration.rb +12 -6
- data/spec/support/shared/server_selector.rb +10 -0
- data/spec/support/shared/session.rb +13 -12
- data/spec/support/spec_config.rb +32 -22
- data/spec/support/spec_setup.rb +2 -2
- data/spec/support/transactions.rb +87 -0
- data/spec/support/transactions/context.rb +33 -0
- data/spec/support/transactions/operation.rb +99 -349
- data/spec/support/transactions/spec.rb +1 -3
- data/spec/support/transactions/test.rb +110 -49
- data/spec/support/utils.rb +74 -1
- metadata +52 -10
- metadata.gz.sig +0 -0
- data/spec/support/crud/read.rb +0 -265
- data/spec/support/crud/write.rb +0 -284
@@ -10,7 +10,7 @@ tests:
|
|
10
10
|
documents:
|
11
11
|
- {_id: 2, x: 22}
|
12
12
|
- {_id: 3, x: 33}
|
13
|
-
|
13
|
+
options: { ordered: true }
|
14
14
|
outcome:
|
15
15
|
result:
|
16
16
|
insertedIds: { 0: 2, 1: 3 }
|
@@ -18,4 +18,60 @@ tests:
|
|
18
18
|
data:
|
19
19
|
- {_id: 1, x: 11}
|
20
20
|
- {_id: 2, x: 22}
|
21
|
-
- {_id: 3, x: 33}
|
21
|
+
- {_id: 3, x: 33}
|
22
|
+
-
|
23
|
+
description: "InsertMany continue-on-error behavior with unordered (preexisting duplicate key)"
|
24
|
+
operation:
|
25
|
+
name: "insertMany"
|
26
|
+
arguments:
|
27
|
+
documents:
|
28
|
+
- { _id: 1, x: 11 }
|
29
|
+
- { _id: 2, x: 22 }
|
30
|
+
- { _id: 3, x: 33 }
|
31
|
+
options: { ordered: false }
|
32
|
+
outcome:
|
33
|
+
error: true
|
34
|
+
result:
|
35
|
+
deletedCount: 0
|
36
|
+
insertedCount: 2
|
37
|
+
# Since the map of insertedIds is generated before execution it
|
38
|
+
# could indicate inserts that did not actually succeed. We omit
|
39
|
+
# this field rather than expect drivers to provide an accurate
|
40
|
+
# map filtered by write errors.
|
41
|
+
matchedCount: 0
|
42
|
+
modifiedCount: 0
|
43
|
+
upsertedCount: 0
|
44
|
+
upsertedIds: { }
|
45
|
+
collection:
|
46
|
+
data:
|
47
|
+
- { _id: 1, x: 11 }
|
48
|
+
- { _id: 2, x: 22 }
|
49
|
+
- { _id: 3, x: 33 }
|
50
|
+
-
|
51
|
+
description: "InsertMany continue-on-error behavior with unordered (duplicate key in requests)"
|
52
|
+
operation:
|
53
|
+
name: "insertMany"
|
54
|
+
arguments:
|
55
|
+
documents:
|
56
|
+
- { _id: 2, x: 22 }
|
57
|
+
- { _id: 2, x: 22 }
|
58
|
+
- { _id: 3, x: 33 }
|
59
|
+
options: { ordered: false }
|
60
|
+
outcome:
|
61
|
+
error: true
|
62
|
+
result:
|
63
|
+
deletedCount: 0
|
64
|
+
insertedCount: 2
|
65
|
+
# Since the map of insertedIds is generated before execution it
|
66
|
+
# could indicate inserts that did not actually succeed. We omit
|
67
|
+
# this field rather than expect drivers to provide an accurate
|
68
|
+
# map filtered by write errors.
|
69
|
+
matchedCount: 0
|
70
|
+
modifiedCount: 0
|
71
|
+
upsertedCount: 0
|
72
|
+
upsertedIds: { }
|
73
|
+
collection:
|
74
|
+
data:
|
75
|
+
- { _id: 1, x: 11 }
|
76
|
+
- { _id: 2, x: 22 }
|
77
|
+
- { _id: 3, x: 33 }
|
@@ -19,6 +19,7 @@ tests:
|
|
19
19
|
result:
|
20
20
|
matchedCount: 2
|
21
21
|
modifiedCount: 0
|
22
|
+
upsertedCount: 0
|
22
23
|
collection:
|
23
24
|
data:
|
24
25
|
- {_id: 1, y: [{b: 3}, {b: 1}]}
|
@@ -38,6 +39,7 @@ tests:
|
|
38
39
|
result:
|
39
40
|
matchedCount: 2
|
40
41
|
modifiedCount: 1
|
42
|
+
upsertedCount: 0
|
41
43
|
collection:
|
42
44
|
data:
|
43
45
|
- {_id: 1, y: [{b: 2}, {b: 1}]}
|
@@ -57,6 +59,7 @@ tests:
|
|
57
59
|
result:
|
58
60
|
matchedCount: 2
|
59
61
|
modifiedCount: 2
|
62
|
+
upsertedCount: 0
|
60
63
|
collection:
|
61
64
|
data:
|
62
65
|
- {_id: 1, y: [{b: 3}, {b: 2}]}
|
@@ -20,6 +20,7 @@ tests:
|
|
20
20
|
result:
|
21
21
|
matchedCount: 1
|
22
22
|
modifiedCount: 0
|
23
|
+
upsertedCount: 0
|
23
24
|
collection:
|
24
25
|
data:
|
25
26
|
- {_id: 1, y: [{b: 3}, {b: 1}]}
|
@@ -40,6 +41,7 @@ tests:
|
|
40
41
|
result:
|
41
42
|
matchedCount: 1
|
42
43
|
modifiedCount: 1
|
44
|
+
upsertedCount: 0
|
43
45
|
collection:
|
44
46
|
data:
|
45
47
|
- {_id: 1, y: [{b: 2}, {b: 1}]}
|
@@ -60,6 +62,7 @@ tests:
|
|
60
62
|
result:
|
61
63
|
matchedCount: 1
|
62
64
|
modifiedCount: 1
|
65
|
+
upsertedCount: 0
|
63
66
|
collection:
|
64
67
|
data:
|
65
68
|
- {_id: 1, y: [{b: 3}, {b: 2}]}
|
@@ -80,7 +83,8 @@ tests:
|
|
80
83
|
outcome:
|
81
84
|
result:
|
82
85
|
matchedCount: 1
|
83
|
-
modifiedCount: 0
|
86
|
+
modifiedCount: 0
|
87
|
+
upsertedCount: 0
|
84
88
|
collection:
|
85
89
|
data:
|
86
90
|
- {_id: 1, y: [{b: 3}, {b: 1}]}
|
@@ -102,6 +106,7 @@ tests:
|
|
102
106
|
result:
|
103
107
|
matchedCount: 1
|
104
108
|
modifiedCount: 1
|
109
|
+
upsertedCount: 0
|
105
110
|
collection:
|
106
111
|
data:
|
107
112
|
- {_id: 1, y: [{b: 3}, {b: 1}]}
|
@@ -0,0 +1,103 @@
|
|
1
|
+
runOn:
|
2
|
+
-
|
3
|
+
minServerVersion: "4.2.0"
|
4
|
+
|
5
|
+
data:
|
6
|
+
- { _id: 1, x: 11 }
|
7
|
+
- { _id: 2, x: 22 }
|
8
|
+
- { _id: 3, x: 33 }
|
9
|
+
|
10
|
+
collection_name: &collection_name 'test_aggregate_merge'
|
11
|
+
|
12
|
+
tests:
|
13
|
+
-
|
14
|
+
description: "Aggregate with $merge"
|
15
|
+
operations:
|
16
|
+
-
|
17
|
+
object: collection
|
18
|
+
name: aggregate
|
19
|
+
arguments: &arguments
|
20
|
+
pipeline: &pipeline
|
21
|
+
- $sort: { x : 1 }
|
22
|
+
- $match: { _id: { $gt: 1 } }
|
23
|
+
- $merge: { into: &output_collection "other_test_collection" }
|
24
|
+
expectations:
|
25
|
+
-
|
26
|
+
command_started_event:
|
27
|
+
command:
|
28
|
+
aggregate: *collection_name
|
29
|
+
pipeline: *pipeline
|
30
|
+
outcome: &outcome
|
31
|
+
collection:
|
32
|
+
name: *output_collection
|
33
|
+
data:
|
34
|
+
- { _id: 2, x: 22 }
|
35
|
+
- { _id: 3, x: 33 }
|
36
|
+
-
|
37
|
+
description: "Aggregate with $merge and batch size of 0"
|
38
|
+
operations:
|
39
|
+
-
|
40
|
+
object: collection
|
41
|
+
name: aggregate
|
42
|
+
arguments:
|
43
|
+
<<: *arguments
|
44
|
+
batchSize: 0
|
45
|
+
expectations:
|
46
|
+
-
|
47
|
+
command_started_event:
|
48
|
+
command:
|
49
|
+
aggregate: *collection_name
|
50
|
+
pipeline: *pipeline
|
51
|
+
cursor: {}
|
52
|
+
outcome: *outcome
|
53
|
+
-
|
54
|
+
description: "Aggregate with $merge and majority readConcern"
|
55
|
+
operations:
|
56
|
+
-
|
57
|
+
object: collection
|
58
|
+
name: aggregate
|
59
|
+
collectionOptions:
|
60
|
+
readConcern: { level: "majority" }
|
61
|
+
arguments: *arguments
|
62
|
+
expectations:
|
63
|
+
-
|
64
|
+
command_started_event:
|
65
|
+
command:
|
66
|
+
aggregate: *collection_name
|
67
|
+
pipeline: *pipeline
|
68
|
+
readConcern: { level: "majority" }
|
69
|
+
outcome: *outcome
|
70
|
+
-
|
71
|
+
description: "Aggregate with $merge and local readConcern"
|
72
|
+
operations:
|
73
|
+
-
|
74
|
+
object: collection
|
75
|
+
name: aggregate
|
76
|
+
collectionOptions:
|
77
|
+
readConcern: { level: "local" }
|
78
|
+
arguments: *arguments
|
79
|
+
expectations:
|
80
|
+
-
|
81
|
+
command_started_event:
|
82
|
+
command:
|
83
|
+
aggregate: *collection_name
|
84
|
+
pipeline: *pipeline
|
85
|
+
readConcern: { level: "local" }
|
86
|
+
outcome: *outcome
|
87
|
+
-
|
88
|
+
description: "Aggregate with $merge and available readConcern"
|
89
|
+
operations:
|
90
|
+
-
|
91
|
+
object: collection
|
92
|
+
name: aggregate
|
93
|
+
collectionOptions:
|
94
|
+
readConcern: { level: "available" }
|
95
|
+
arguments: *arguments
|
96
|
+
expectations:
|
97
|
+
-
|
98
|
+
command_started_event:
|
99
|
+
command:
|
100
|
+
aggregate: *collection_name
|
101
|
+
pipeline: *pipeline
|
102
|
+
readConcern: { level: "available" }
|
103
|
+
outcome: *outcome
|
@@ -0,0 +1,110 @@
|
|
1
|
+
runOn:
|
2
|
+
-
|
3
|
+
minServerVersion: "4.1.0"
|
4
|
+
topology: ["replicaset", "sharded"]
|
5
|
+
|
6
|
+
data:
|
7
|
+
- { _id: 1, x: 11 }
|
8
|
+
- { _id: 2, x: 22 }
|
9
|
+
- { _id: 3, x: 33 }
|
10
|
+
|
11
|
+
collection_name: &collection_name 'test_aggregate_out_readconcern'
|
12
|
+
|
13
|
+
tests:
|
14
|
+
-
|
15
|
+
description: "readConcern majority with out stage"
|
16
|
+
operations:
|
17
|
+
-
|
18
|
+
object: collection
|
19
|
+
name: aggregate
|
20
|
+
collectionOptions:
|
21
|
+
readConcern: { level: "majority" }
|
22
|
+
arguments: &arguments
|
23
|
+
pipeline:
|
24
|
+
- $sort: { x : 1 }
|
25
|
+
- $match: { _id: { $gt: 1 } }
|
26
|
+
- $out: &output_collection "other_test_collection"
|
27
|
+
expectations:
|
28
|
+
-
|
29
|
+
command_started_event:
|
30
|
+
command:
|
31
|
+
aggregate: *collection_name
|
32
|
+
pipeline: &pipeline
|
33
|
+
- $sort: { x: 1 }
|
34
|
+
- $match: { _id: { $gt: 1 } }
|
35
|
+
- $out: "other_test_collection"
|
36
|
+
readConcern: { level: "majority" }
|
37
|
+
outcome: &outcome
|
38
|
+
collection:
|
39
|
+
name: *output_collection
|
40
|
+
data:
|
41
|
+
- { _id: 2, x: 22 }
|
42
|
+
- { _id: 3, x: 33 }
|
43
|
+
-
|
44
|
+
description: "readConcern local with out stage"
|
45
|
+
operations:
|
46
|
+
-
|
47
|
+
object: collection
|
48
|
+
name: aggregate
|
49
|
+
collectionOptions:
|
50
|
+
readConcern: { level: "local" }
|
51
|
+
arguments: *arguments
|
52
|
+
expectations:
|
53
|
+
-
|
54
|
+
command_started_event:
|
55
|
+
command:
|
56
|
+
aggregate: *collection_name
|
57
|
+
pipeline: *pipeline
|
58
|
+
readConcern: { level: "local" }
|
59
|
+
outcome: *outcome
|
60
|
+
-
|
61
|
+
description: "readConcern available with out stage"
|
62
|
+
operations:
|
63
|
+
-
|
64
|
+
object: collection
|
65
|
+
name: aggregate
|
66
|
+
collectionOptions:
|
67
|
+
readConcern: { level: "available" }
|
68
|
+
arguments: *arguments
|
69
|
+
expectations:
|
70
|
+
-
|
71
|
+
command_started_event:
|
72
|
+
command:
|
73
|
+
aggregate: *collection_name
|
74
|
+
pipeline: *pipeline
|
75
|
+
readConcern: { level: "available" }
|
76
|
+
outcome: *outcome
|
77
|
+
-
|
78
|
+
description: "readConcern linearizable with out stage"
|
79
|
+
operations:
|
80
|
+
-
|
81
|
+
object: collection
|
82
|
+
name: aggregate
|
83
|
+
collectionOptions:
|
84
|
+
readConcern: { level: "linearizable" }
|
85
|
+
arguments: *arguments
|
86
|
+
error: true
|
87
|
+
expectations:
|
88
|
+
-
|
89
|
+
command_started_event:
|
90
|
+
command:
|
91
|
+
aggregate: *collection_name
|
92
|
+
pipeline: *pipeline
|
93
|
+
readConcern: { level: "linearizable" }
|
94
|
+
-
|
95
|
+
description: "invalid readConcern with out stage"
|
96
|
+
operations:
|
97
|
+
-
|
98
|
+
object: collection
|
99
|
+
name: aggregate
|
100
|
+
collectionOptions:
|
101
|
+
readConcern: { level: "!invalid123" }
|
102
|
+
arguments: *arguments
|
103
|
+
error: true
|
104
|
+
expectations:
|
105
|
+
-
|
106
|
+
command_started_event:
|
107
|
+
command:
|
108
|
+
aggregate: *collection_name
|
109
|
+
pipeline: *pipeline
|
110
|
+
readConcern: { level: "!invalid123" }
|
@@ -0,0 +1,81 @@
|
|
1
|
+
runOn:
|
2
|
+
-
|
3
|
+
minServerVersion: "3.5.6"
|
4
|
+
|
5
|
+
data:
|
6
|
+
- {_id: 1, y: [{b: 3}, {b: 1}]}
|
7
|
+
- {_id: 2, y: [{b: 0}, {b: 1}]}
|
8
|
+
|
9
|
+
collection_name: &collection_name "test"
|
10
|
+
database_name: &database_name "crud-tests"
|
11
|
+
|
12
|
+
tests:
|
13
|
+
-
|
14
|
+
description: "BulkWrite with arrayFilters"
|
15
|
+
operations:
|
16
|
+
-
|
17
|
+
name: "bulkWrite"
|
18
|
+
arguments:
|
19
|
+
requests:
|
20
|
+
-
|
21
|
+
# UpdateOne when one document matches arrayFilters
|
22
|
+
name: "updateOne"
|
23
|
+
arguments:
|
24
|
+
filter: {}
|
25
|
+
update: { $set: { "y.$[i].b": 2 } }
|
26
|
+
arrayFilters: [ { "i.b": 3 } ]
|
27
|
+
-
|
28
|
+
# UpdateMany when multiple documents match arrayFilters
|
29
|
+
name: "updateMany"
|
30
|
+
arguments:
|
31
|
+
filter: {}
|
32
|
+
update: { $set: { "y.$[i].b": 2 } }
|
33
|
+
arrayFilters: [ { "i.b": 1 } ]
|
34
|
+
options: { ordered: true }
|
35
|
+
result:
|
36
|
+
deletedCount: 0
|
37
|
+
insertedCount: 0
|
38
|
+
insertedIds: {}
|
39
|
+
matchedCount: 3
|
40
|
+
modifiedCount: 3
|
41
|
+
upsertedCount: 0
|
42
|
+
upsertedIds: {}
|
43
|
+
expectations:
|
44
|
+
-
|
45
|
+
command_started_event:
|
46
|
+
command:
|
47
|
+
update: *collection_name
|
48
|
+
updates:
|
49
|
+
-
|
50
|
+
q: {}
|
51
|
+
u: { $set: { "y.$[i].b": 2 } }
|
52
|
+
arrayFilters: [ { "i.b": 3 } ]
|
53
|
+
ordered: true
|
54
|
+
# TODO: check that these fields do not exist once
|
55
|
+
# https://jira.mongodb.org/browse/SPEC-1215 has been resolved.
|
56
|
+
# writeConcern: null
|
57
|
+
# bypassDocumentValidation: null
|
58
|
+
command_name: update
|
59
|
+
database_name: *database_name
|
60
|
+
-
|
61
|
+
command_started_event:
|
62
|
+
command:
|
63
|
+
update: *collection_name
|
64
|
+
updates:
|
65
|
+
-
|
66
|
+
q: {}
|
67
|
+
u: { $set: { "y.$[i].b": 2 } }
|
68
|
+
multi: true
|
69
|
+
arrayFilters: [ { "i.b": 1 } ]
|
70
|
+
ordered: true
|
71
|
+
# TODO: check that these fields do not exist once
|
72
|
+
# https://jira.mongodb.org/browse/SPEC-1215 has been resolved.
|
73
|
+
# writeConcern: null
|
74
|
+
# bypassDocumentValidation: null
|
75
|
+
command_name: update
|
76
|
+
database_name: *database_name
|
77
|
+
outcome:
|
78
|
+
collection:
|
79
|
+
data:
|
80
|
+
- {_id: 1, y: [{b: 2}, {b: 2}]}
|
81
|
+
- {_id: 2, y: [{b: 0}, {b: 2}]}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
runOn:
|
2
|
+
-
|
3
|
+
minServerVersion: "3.6.0"
|
4
|
+
|
5
|
+
database_name: &database_name "admin"
|
6
|
+
|
7
|
+
tests:
|
8
|
+
-
|
9
|
+
description: "Aggregate with $listLocalSessions"
|
10
|
+
operations:
|
11
|
+
-
|
12
|
+
name: aggregate
|
13
|
+
object: database
|
14
|
+
arguments:
|
15
|
+
pipeline:
|
16
|
+
- $listLocalSessions: { }
|
17
|
+
- $limit: 1
|
18
|
+
- $addFields: { dummy: "dummy field"}
|
19
|
+
- $project: { _id: 0, dummy: 1}
|
20
|
+
result:
|
21
|
+
-
|
22
|
+
dummy: "dummy field"
|
23
|
+
-
|
24
|
+
description: "Aggregate with $listLocalSessions and allowDiskUse"
|
25
|
+
operations:
|
26
|
+
-
|
27
|
+
name: aggregate
|
28
|
+
object: database
|
29
|
+
arguments:
|
30
|
+
pipeline:
|
31
|
+
- $listLocalSessions: { }
|
32
|
+
- $limit: 1
|
33
|
+
- $addFields: { dummy: "dummy field"}
|
34
|
+
- $project: { _id: 0, dummy: 1 }
|
35
|
+
allowDiskUse: true
|
36
|
+
result:
|
37
|
+
-
|
38
|
+
dummy: "dummy field"
|