mongo 2.18.1 → 2.18.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/lib/mongo/bulk_write.rb +6 -4
  4. data/lib/mongo/client.rb +1 -1
  5. data/lib/mongo/collection/view/writable.rb +0 -2
  6. data/lib/mongo/collection.rb +150 -45
  7. data/lib/mongo/crypt/kms.rb +0 -1
  8. data/lib/mongo/error/invalid_read_option.rb +1 -1
  9. data/lib/mongo/operation/aggregate.rb +1 -2
  10. data/lib/mongo/operation/collections_info.rb +3 -15
  11. data/lib/mongo/operation/command.rb +1 -2
  12. data/lib/mongo/operation/count.rb +1 -2
  13. data/lib/mongo/operation/create.rb +1 -2
  14. data/lib/mongo/operation/create_index.rb +1 -2
  15. data/lib/mongo/operation/create_user.rb +1 -2
  16. data/lib/mongo/operation/delete.rb +0 -1
  17. data/lib/mongo/operation/distinct.rb +1 -2
  18. data/lib/mongo/operation/drop.rb +1 -2
  19. data/lib/mongo/operation/drop_database.rb +1 -2
  20. data/lib/mongo/operation/drop_index.rb +1 -2
  21. data/lib/mongo/operation/explain.rb +1 -3
  22. data/lib/mongo/operation/find/builder.rb +0 -1
  23. data/lib/mongo/operation/find.rb +1 -3
  24. data/lib/mongo/operation/get_more.rb +1 -3
  25. data/lib/mongo/operation/indexes.rb +1 -17
  26. data/lib/mongo/operation/insert.rb +0 -1
  27. data/lib/mongo/operation/kill_cursors.rb +1 -2
  28. data/lib/mongo/operation/list_collections.rb +1 -2
  29. data/lib/mongo/operation/map_reduce.rb +1 -2
  30. data/lib/mongo/operation/parallel_scan.rb +1 -2
  31. data/lib/mongo/operation/remove_user.rb +1 -2
  32. data/lib/mongo/operation/shared/{polymorphic_operation.rb → op_msg_executable.rb} +11 -6
  33. data/lib/mongo/operation/update.rb +0 -1
  34. data/lib/mongo/operation/update_user.rb +1 -2
  35. data/lib/mongo/operation/users_info.rb +1 -2
  36. data/lib/mongo/operation/write_command.rb +1 -2
  37. data/lib/mongo/operation.rb +1 -3
  38. data/lib/mongo/protocol.rb +0 -3
  39. data/lib/mongo/query_cache.rb +20 -20
  40. data/lib/mongo/session.rb +1 -1
  41. data/lib/mongo/version.rb +1 -1
  42. data/spec/integration/command_spec.rb +1 -23
  43. data/spec/mongo/client_construction_spec.rb +4 -4
  44. data/spec/mongo/collection_crud_spec.rb +56 -0
  45. data/spec/mongo/collection_spec.rb +11 -1
  46. data/spec/mongo/crypt/kms_spec.rb +12 -9
  47. data.tar.gz.sig +0 -0
  48. metadata +1133 -1186
  49. metadata.gz.sig +0 -0
  50. data/lib/mongo/operation/aggregate/command.rb +0 -55
  51. data/lib/mongo/operation/collections_info/command.rb +0 -48
  52. data/lib/mongo/operation/command/command.rb +0 -41
  53. data/lib/mongo/operation/count/command.rb +0 -47
  54. data/lib/mongo/operation/create/command.rb +0 -47
  55. data/lib/mongo/operation/create_index/command.rb +0 -61
  56. data/lib/mongo/operation/create_user/command.rb +0 -46
  57. data/lib/mongo/operation/delete/command.rb +0 -52
  58. data/lib/mongo/operation/distinct/command.rb +0 -47
  59. data/lib/mongo/operation/drop/command.rb +0 -41
  60. data/lib/mongo/operation/drop_database/command.rb +0 -41
  61. data/lib/mongo/operation/drop_index/command.rb +0 -45
  62. data/lib/mongo/operation/explain/command.rb +0 -58
  63. data/lib/mongo/operation/explain/legacy.rb +0 -52
  64. data/lib/mongo/operation/find/builder/legacy.rb +0 -123
  65. data/lib/mongo/operation/find/command.rb +0 -51
  66. data/lib/mongo/operation/find/legacy/result.rb +0 -46
  67. data/lib/mongo/operation/find/legacy.rb +0 -52
  68. data/lib/mongo/operation/get_more/command.rb +0 -43
  69. data/lib/mongo/operation/get_more/legacy.rb +0 -39
  70. data/lib/mongo/operation/indexes/command.rb +0 -42
  71. data/lib/mongo/operation/indexes/legacy.rb +0 -48
  72. data/lib/mongo/operation/insert/command.rb +0 -55
  73. data/lib/mongo/operation/kill_cursors/command.rb +0 -48
  74. data/lib/mongo/operation/list_collections/command.rb +0 -46
  75. data/lib/mongo/operation/map_reduce/command.rb +0 -51
  76. data/lib/mongo/operation/parallel_scan/command.rb +0 -57
  77. data/lib/mongo/operation/remove_user/command.rb +0 -46
  78. data/lib/mongo/operation/shared/op_msg_or_command.rb +0 -41
  79. data/lib/mongo/operation/shared/op_msg_or_find_command.rb +0 -44
  80. data/lib/mongo/operation/update/command.rb +0 -53
  81. data/lib/mongo/operation/update_user/command.rb +0 -45
  82. data/lib/mongo/operation/users_info/command.rb +0 -46
  83. data/lib/mongo/operation/write_command/command.rb +0 -51
  84. data/lib/mongo/protocol/delete.rb +0 -172
  85. data/lib/mongo/protocol/insert.rb +0 -181
  86. data/lib/mongo/protocol/update.rb +0 -214
  87. data/spec/mongo/operation/delete/command_spec.rb +0 -115
  88. data/spec/mongo/operation/find/legacy_spec.rb +0 -131
  89. data/spec/mongo/operation/get_more_spec.rb +0 -63
  90. data/spec/mongo/operation/insert/command_spec.rb +0 -118
  91. data/spec/mongo/operation/update/command_spec.rb +0 -122
  92. data/spec/mongo/protocol/delete_spec.rb +0 -185
  93. data/spec/mongo/protocol/insert_spec.rb +0 -179
  94. data/spec/mongo/protocol/update_spec.rb +0 -204
@@ -1,123 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- # Copyright (C) 2015-2020 MongoDB Inc.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- module Mongo
19
- module Operation
20
- class Find
21
- module Builder
22
-
23
- # Builds a legacy OP_QUERY specification from options.
24
- #
25
- # @api private
26
- module Legacy
27
-
28
- # Mappings from driver options to legacy server values.
29
- #
30
- # @since 2.2.0
31
- DRIVER_MAPPINGS = {
32
- comment: '$comment',
33
- explain: '$explain',
34
- hint: '$hint',
35
- max_scan: '$maxScan',
36
- max_time_ms: '$maxTimeMS',
37
- max_value: '$max',
38
- min_value: '$min',
39
- show_disk_loc: '$showDiskLoc',
40
- snapshot: '$snapshot',
41
- sort: '$orderby',
42
- return_key: '$returnKey',
43
- }.freeze
44
-
45
- module_function def selector(spec, connection)
46
- if Lint.enabled?
47
- if spec.keys.any? { |k| String === k }
48
- raise Error::LintError, "The spec must contain symbol keys only"
49
- end
50
- end
51
-
52
- # Server versions that do not have the find command feature
53
- # (versions older than 3.2) do not support the allow_disk_use option
54
- # but perform no validation and will not raise an error if it is
55
- # specified. If the allow_disk_use option is specified, raise an error
56
- # to alert the user.
57
- unless spec[:allow_disk_use].nil?
58
- raise Error::UnsupportedOption.allow_disk_use_error
59
- end
60
-
61
- if spec[:collation] && !connection.features.collation_enabled?
62
- raise Error::UnsupportedCollation
63
- end
64
-
65
- modifiers = {}
66
- DRIVER_MAPPINGS.each do |k, server_k|
67
- unless (value = spec[k]).nil?
68
- modifiers[server_k] = value
69
- end
70
- end
71
-
72
- selector = spec[:filter] || BSON::Document.new
73
- # Write nil into rp if not talking to mongos, rather than false
74
- rp = if connection.description.mongos?
75
- read_pref_formatted(spec)
76
- end
77
- if modifiers.any? || rp
78
- selector = {'$query' => selector}.update(modifiers)
79
-
80
- if rp
81
- selector['$readPreference'] = rp
82
- end
83
- end
84
-
85
- selector
86
- end
87
-
88
- module_function def query_options(spec, connection)
89
- query_options = {
90
- project: spec[:projection],
91
- skip: spec[:skip],
92
- limit: spec[:limit],
93
- # batch_size is converted to batchSize by Mongo::Protocol::Query.
94
- batch_size: spec[:batch_size],
95
- }
96
-
97
- unless (flags = Builder::Flags.map_flags(spec)).empty?
98
- query_options[:flags] = ((query_options[:flags] || []) + flags).uniq
99
- end
100
-
101
- query_options
102
- end
103
-
104
- private
105
-
106
- module_function def read_pref_formatted(spec)
107
- if spec[:read_preference]
108
- raise ArgumentError, "Spec cannot include :read_preference here, use :read"
109
- end
110
-
111
- if read = spec[:read]
112
- read_pref = ServerSelector.get(read).to_mongos
113
- Mongo::Lint.validate_camel_case_read_preference(read_pref)
114
- read_pref
115
- else
116
- nil
117
- end
118
- end
119
- end
120
- end
121
- end
122
- end
123
- end
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- # Copyright (C) 2018-2020 MongoDB Inc.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- module Mongo
19
- module Operation
20
- class Find
21
-
22
- # A MongoDB find operation sent as a command message.
23
- #
24
- # @api private
25
- #
26
- # @since 2.5.2
27
- class Command
28
- include Specifiable
29
- include Executable
30
- include Limited
31
- include ReadPreferenceSupported
32
- include PolymorphicResult
33
-
34
- private
35
-
36
- def selector(connection)
37
- # The mappings are BSON::Documents and as such store keys as
38
- # strings, the spec here has symbol keys
39
- spec = BSON::Document.new(self.spec)
40
- {
41
- find: coll_name,
42
- }.update(Find::Builder::Command.selector(spec, connection))
43
- end
44
-
45
- def message(connection)
46
- Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
47
- end
48
- end
49
- end
50
- end
51
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- # Copyright (C) 2014-2020 MongoDB Inc.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- module Mongo
19
- module Operation
20
- class Find
21
- class Legacy
22
-
23
- # Defines custom behavior of results for a query.
24
- #
25
- # @since 2.1.0
26
- # @api semiprivate
27
- class Result < Operation::Result
28
- include Operation::Result::UseLegacyErrorParser
29
-
30
- # Determine if the query was a success.
31
- #
32
- # @example Was the query successful?
33
- # result.successful?
34
- #
35
- # @return [ true, false ] If the query was successful.
36
- #
37
- # @since 2.0.0
38
- # @api public
39
- def successful?
40
- !query_failure?
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- # Copyright (C) 2018-2020 MongoDB Inc.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- require 'mongo/operation/find/legacy/result'
19
-
20
- module Mongo
21
- module Operation
22
- class Find
23
-
24
- # A MongoDB find operation sent as a legacy wire protocol message.
25
- #
26
- # @api private
27
- #
28
- # @since 2.5.2
29
- class Legacy
30
- include Specifiable
31
- include Executable
32
- include ReadPreferenceSupported
33
- include PolymorphicResult
34
-
35
- private
36
-
37
- def message(connection)
38
- selector = Find::Builder::Legacy.selector(spec, connection)
39
- options = options(connection).update(
40
- Find::Builder::Legacy.query_options(spec, connection),
41
- )
42
- Protocol::Query.new(
43
- db_name,
44
- coll_name,
45
- selector,
46
- options,
47
- )
48
- end
49
- end
50
- end
51
- end
52
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- # Copyright (C) 2018-2020 MongoDB Inc.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- module Mongo
19
- module Operation
20
- class GetMore
21
-
22
- # A MongoDB getMore operation sent as a command message.
23
- #
24
- # @api private
25
- #
26
- # @since 2.5.2
27
- class Command
28
- include Specifiable
29
- include Executable
30
- include Limited
31
- include ReadPreferenceSupported
32
- include PolymorphicResult
33
- include CommandBuilder
34
-
35
- private
36
-
37
- def message(connection)
38
- Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- # Copyright (C) 2018-2020 MongoDB Inc.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- module Mongo
19
- module Operation
20
- class GetMore
21
-
22
- # A MongoDB getMore operation sent as a legacy wire protocol message.
23
- #
24
- # @api private
25
- #
26
- # @since 2.5.2
27
- class Legacy
28
- include Specifiable
29
- include Executable
30
-
31
- private
32
-
33
- def message(connection)
34
- Protocol::GetMore.new(db_name, coll_name, to_return, cursor_id)
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- # Copyright (C) 2018-2020 MongoDB Inc.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- module Mongo
19
- module Operation
20
- class Indexes
21
-
22
- # A MongoDB indexes operation sent as a command message.
23
- #
24
- # @api private
25
- #
26
- # @since 2.5.2
27
- class Command
28
- include Specifiable
29
- include Executable
30
- include Limited
31
- include ReadPreferenceSupported
32
- include PolymorphicResult
33
-
34
- private
35
-
36
- def message(connection)
37
- Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- # Copyright (C) 2014-2020 MongoDB Inc.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- module Mongo
19
- module Operation
20
- class Indexes
21
-
22
- # A MongoDB indexes operation sent as a legacy wire protocol message.
23
- #
24
- # @api private
25
- #
26
- # @since 2.5.2
27
- class Legacy
28
- include Specifiable
29
- include Executable
30
- include ReadPreferenceSupported
31
-
32
- private
33
-
34
- def selector(connection)
35
- { ns: namespace }
36
- end
37
-
38
- def message(connection)
39
- Protocol::Query.new(db_name, Index::COLLECTION, command(connection), options(connection))
40
- end
41
-
42
- def result_class
43
- Operation::Result
44
- end
45
- end
46
- end
47
- end
48
- end
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- # Copyright (C) 2018-2020 MongoDB Inc.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- module Mongo
19
- module Operation
20
- class Insert
21
-
22
- # A MongoDB insert operation sent as a command message.
23
- #
24
- # @api private
25
- #
26
- # @since 2.5.2
27
- class Command
28
- include Specifiable
29
- include Executable
30
- include ExecutableNoValidate
31
- include Idable
32
- include Limited
33
- include WriteConcernSupported
34
- include BypassDocumentValidation
35
-
36
- private
37
-
38
- def get_result(connection, context, options = {})
39
- # This is a Mongo::Operation::Insert::Result
40
- Result.new(*dispatch_message(connection, context), @ids)
41
- end
42
-
43
- def selector(connection)
44
- { insert: coll_name,
45
- documents: send(IDENTIFIER),
46
- ordered: ordered? }
47
- end
48
-
49
- def message(connection)
50
- Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
51
- end
52
- end
53
- end
54
- end
55
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- # Copyright (C) 2018-2020 MongoDB Inc.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- module Mongo
19
- module Operation
20
- class KillCursors
21
-
22
- # A MongoDB killcursors operation sent as a command message.
23
- #
24
- # @api private
25
- #
26
- # @since 2.5.2
27
- class Command
28
- include Specifiable
29
- include Executable
30
- include Limited
31
- include CommandBuilder
32
-
33
- private
34
-
35
- def selector(connection)
36
- {
37
- killCursors: coll_name,
38
- cursors: int64_cursor_ids,
39
- }
40
- end
41
-
42
- def message(connection)
43
- Protocol::Query.new(db_name, Database::COMMAND, selector(connection), options(connection))
44
- end
45
- end
46
- end
47
- end
48
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- # Copyright (C) 2018-2020 MongoDB Inc.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- module Mongo
19
- module Operation
20
- class ListCollections
21
-
22
- # A MongoDB listcollections operation sent as a command message.
23
- #
24
- # @api private
25
- #
26
- # @since 2.5.2
27
- class Command
28
- include Specifiable
29
- include Executable
30
- include Limited
31
- include ReadPreferenceSupported
32
- include PolymorphicResult
33
-
34
- private
35
-
36
- def selector(connection)
37
- (spec[SELECTOR] || {}).merge(listCollections: 1)
38
- end
39
-
40
- def message(connection)
41
- Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- # Copyright (C) 2018-2020 MongoDB Inc.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- module Mongo
19
- module Operation
20
- class MapReduce
21
-
22
- # A MongoDB mapreduce operation sent as a command message.
23
- #
24
- # @api private
25
- #
26
- # @since 2.5.2
27
- class Command
28
- include Specifiable
29
- include Executable
30
- include Limited
31
- include ReadPreferenceSupported
32
- include WriteConcernSupported
33
- include PolymorphicResult
34
-
35
- private
36
-
37
- def selector(connection)
38
- super.tap do |selector|
39
- if selector[:collation] && !connection.features.collation_enabled?
40
- raise Error::UnsupportedCollation
41
- end
42
- end
43
- end
44
-
45
- def message(connection)
46
- Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
47
- end
48
- end
49
- end
50
- end
51
- end