mongo 2.18.0 → 2.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/mongo/bulk_write.rb +7 -5
- data/lib/mongo/client.rb +1 -1
- data/lib/mongo/collection/view/writable.rb +0 -2
- data/lib/mongo/collection.rb +150 -45
- data/lib/mongo/crypt/auto_encrypter.rb +30 -9
- data/lib/mongo/crypt/binding.rb +93 -1
- data/lib/mongo/crypt/explicit_encrypter.rb +5 -1
- data/lib/mongo/crypt/handle.rb +33 -0
- data/lib/mongo/crypt/kms.rb +0 -1
- data/lib/mongo/cursor.rb +6 -1
- data/lib/mongo/error/invalid_read_option.rb +1 -1
- data/lib/mongo/operation/aggregate.rb +1 -2
- data/lib/mongo/operation/collections_info.rb +3 -15
- data/lib/mongo/operation/command.rb +1 -2
- data/lib/mongo/operation/count.rb +1 -2
- data/lib/mongo/operation/create.rb +1 -2
- data/lib/mongo/operation/create_index.rb +1 -2
- data/lib/mongo/operation/create_user.rb +1 -2
- data/lib/mongo/operation/delete.rb +0 -1
- data/lib/mongo/operation/distinct.rb +1 -2
- data/lib/mongo/operation/drop.rb +1 -2
- data/lib/mongo/operation/drop_database.rb +1 -2
- data/lib/mongo/operation/drop_index.rb +1 -2
- data/lib/mongo/operation/explain.rb +1 -3
- data/lib/mongo/operation/find/builder.rb +0 -1
- data/lib/mongo/operation/find.rb +1 -3
- data/lib/mongo/operation/get_more.rb +1 -3
- data/lib/mongo/operation/indexes.rb +1 -17
- data/lib/mongo/operation/insert.rb +0 -1
- data/lib/mongo/operation/kill_cursors.rb +1 -2
- data/lib/mongo/operation/list_collections.rb +1 -2
- data/lib/mongo/operation/map_reduce.rb +1 -2
- data/lib/mongo/operation/parallel_scan.rb +1 -2
- data/lib/mongo/operation/remove_user.rb +1 -2
- data/lib/mongo/operation/shared/{polymorphic_operation.rb → op_msg_executable.rb} +11 -6
- data/lib/mongo/operation/shared/sessions_supported.rb +7 -3
- data/lib/mongo/operation/update.rb +0 -1
- data/lib/mongo/operation/update_user.rb +1 -2
- data/lib/mongo/operation/users_info.rb +1 -2
- data/lib/mongo/operation/write_command.rb +1 -2
- data/lib/mongo/operation.rb +1 -3
- data/lib/mongo/protocol.rb +0 -3
- data/lib/mongo/query_cache.rb +20 -20
- data/lib/mongo/session.rb +1 -1
- data/lib/mongo/version.rb +1 -1
- data/spec/README.md +5 -1
- data/spec/integration/bulk_write_spec.rb +16 -0
- data/spec/integration/command_spec.rb +1 -23
- data/spec/integration/ocsp_verifier_spec.rb +2 -0
- data/spec/mongo/client_construction_spec.rb +4 -4
- data/spec/mongo/collection_crud_spec.rb +56 -0
- data/spec/mongo/collection_spec.rb +11 -1
- data/spec/mongo/crypt/auto_encrypter_spec.rb +41 -6
- data/spec/mongo/crypt/binding/version_spec.rb +8 -0
- data/spec/mongo/crypt/handle_spec.rb +102 -0
- data/spec/mongo/crypt/kms_spec.rb +12 -9
- data/spec/mongo/cursor_spec.rb +50 -0
- data/spec/shared/lib/mrss/event_subscriber.rb +15 -5
- data/spec/spec_tests/data/change_streams_unified/change-streams-resume-errorLabels.yml +3 -0
- data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey.yml +3 -3
- data/spec/spec_tests/data/sdam_integration/hello-command-error.yml +6 -14
- data/spec/spec_tests/data/sdam_integration/hello-network-error.yml +4 -14
- data/spec/spec_tests/data/sdam_integration/hello-timeout.yml +8 -14
- data/spec/spec_tests/data/transactions_unified/do-not-retry-read-in-transaction.yml +64 -0
- data/spec/spec_tests/data/transactions_unified/retryable-abort-handshake.yml +118 -0
- data/spec/spec_tests/data/transactions_unified/retryable-commit-handshake.yml +118 -0
- data/spec/support/certificates/retrieve-atlas-cert +38 -0
- data/spec/support/spec_config.rb +4 -0
- data.tar.gz.sig +0 -0
- metadata +1133 -1178
- metadata.gz.sig +0 -0
- data/lib/mongo/operation/aggregate/command.rb +0 -55
- data/lib/mongo/operation/collections_info/command.rb +0 -48
- data/lib/mongo/operation/command/command.rb +0 -41
- data/lib/mongo/operation/count/command.rb +0 -47
- data/lib/mongo/operation/create/command.rb +0 -47
- data/lib/mongo/operation/create_index/command.rb +0 -61
- data/lib/mongo/operation/create_user/command.rb +0 -46
- data/lib/mongo/operation/delete/command.rb +0 -52
- data/lib/mongo/operation/distinct/command.rb +0 -47
- data/lib/mongo/operation/drop/command.rb +0 -41
- data/lib/mongo/operation/drop_database/command.rb +0 -41
- data/lib/mongo/operation/drop_index/command.rb +0 -45
- data/lib/mongo/operation/explain/command.rb +0 -58
- data/lib/mongo/operation/explain/legacy.rb +0 -52
- data/lib/mongo/operation/find/builder/legacy.rb +0 -123
- data/lib/mongo/operation/find/command.rb +0 -51
- data/lib/mongo/operation/find/legacy/result.rb +0 -46
- data/lib/mongo/operation/find/legacy.rb +0 -52
- data/lib/mongo/operation/get_more/command.rb +0 -43
- data/lib/mongo/operation/get_more/legacy.rb +0 -39
- data/lib/mongo/operation/indexes/command.rb +0 -42
- data/lib/mongo/operation/indexes/legacy.rb +0 -48
- data/lib/mongo/operation/insert/command.rb +0 -55
- data/lib/mongo/operation/kill_cursors/command.rb +0 -48
- data/lib/mongo/operation/list_collections/command.rb +0 -46
- data/lib/mongo/operation/map_reduce/command.rb +0 -51
- data/lib/mongo/operation/parallel_scan/command.rb +0 -57
- data/lib/mongo/operation/remove_user/command.rb +0 -46
- data/lib/mongo/operation/shared/op_msg_or_command.rb +0 -41
- data/lib/mongo/operation/shared/op_msg_or_find_command.rb +0 -44
- data/lib/mongo/operation/update/command.rb +0 -53
- data/lib/mongo/operation/update_user/command.rb +0 -45
- data/lib/mongo/operation/users_info/command.rb +0 -46
- data/lib/mongo/operation/write_command/command.rb +0 -51
- data/lib/mongo/protocol/delete.rb +0 -172
- data/lib/mongo/protocol/insert.rb +0 -181
- data/lib/mongo/protocol/update.rb +0 -214
- data/spec/mongo/operation/delete/command_spec.rb +0 -115
- data/spec/mongo/operation/find/legacy_spec.rb +0 -131
- data/spec/mongo/operation/get_more_spec.rb +0 -63
- data/spec/mongo/operation/insert/command_spec.rb +0 -118
- data/spec/mongo/operation/update/command_spec.rb +0 -122
- data/spec/mongo/protocol/delete_spec.rb +0 -185
- data/spec/mongo/protocol/insert_spec.rb +0 -179
- data/spec/mongo/protocol/update_spec.rb +0 -204
metadata.gz.sig
CHANGED
Binary file
|
@@ -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 Aggregate
|
21
|
-
|
22
|
-
# A MongoDB aggregate 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 PolymorphicResult
|
31
|
-
include ReadPreferenceSupported
|
32
|
-
include WriteConcernSupported
|
33
|
-
include Limited
|
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 write_concern_supported?(connection)
|
46
|
-
connection.features.collation_enabled?
|
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) 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 CollectionsInfo
|
21
|
-
|
22
|
-
# A MongoDB collectionInfo operation sent as a command message.
|
23
|
-
#
|
24
|
-
# @api private
|
25
|
-
class Command
|
26
|
-
include Specifiable
|
27
|
-
include Executable
|
28
|
-
include ReadPreferenceSupported
|
29
|
-
include PolymorphicResult
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def get_result(connection, context, options = {})
|
34
|
-
# This is a Mongo::Operation::CollectionsInfo::Result
|
35
|
-
Result.new(*dispatch_message(connection, context), db_name)
|
36
|
-
end
|
37
|
-
|
38
|
-
def selector(connection)
|
39
|
-
{}
|
40
|
-
end
|
41
|
-
|
42
|
-
def message(connection)
|
43
|
-
Protocol::Query.new(db_name, Database::NAMESPACES, command(connection), options(connection))
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,41 +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 Command
|
21
|
-
|
22
|
-
# A MongoDB command 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
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def message(connection)
|
36
|
-
Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,47 +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 Count
|
21
|
-
|
22
|
-
# A MongoDB count 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
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def selector(connection)
|
36
|
-
selector = spec[:selector]
|
37
|
-
selector = apply_collation(selector, connection, spec[:collation])
|
38
|
-
selector
|
39
|
-
end
|
40
|
-
|
41
|
-
def message(connection)
|
42
|
-
Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,47 +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 Create
|
21
|
-
|
22
|
-
# A MongoDB create collection 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 WriteConcernSupported
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def selector(connection)
|
36
|
-
selector = spec[:selector]
|
37
|
-
selector = apply_collation(selector, connection, spec[:collation])
|
38
|
-
selector
|
39
|
-
end
|
40
|
-
|
41
|
-
def message(connection)
|
42
|
-
Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,61 +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 CreateIndex
|
21
|
-
|
22
|
-
# A MongoDB createindex 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 WriteConcernSupported
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def selector(connection)
|
36
|
-
indexes.each do |index|
|
37
|
-
if index[:collation] && !connection.features.collation_enabled?
|
38
|
-
raise Error::UnsupportedCollation
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
{
|
43
|
-
createIndexes: coll_name,
|
44
|
-
indexes: indexes,
|
45
|
-
}.tap do |selector|
|
46
|
-
if commit_quorum = spec[:commit_quorum]
|
47
|
-
unless connection.features.commit_quorum_enabled?
|
48
|
-
raise Error::UnsupportedOption.commit_quorum_error
|
49
|
-
end
|
50
|
-
selector[:commitQuorum] = commit_quorum
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def message(connection)
|
56
|
-
Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
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 CreateUser
|
21
|
-
|
22
|
-
# A MongoDB createuser 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
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def selector(connection)
|
37
|
-
{ :createUser => user.name }.merge(user.spec)
|
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,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
|
-
module Mongo
|
19
|
-
module Operation
|
20
|
-
class Delete
|
21
|
-
|
22
|
-
# A MongoDB delete 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 WriteConcernSupported
|
32
|
-
include ExecutableNoValidate
|
33
|
-
include PolymorphicResult
|
34
|
-
include Validatable
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def selector(connection)
|
39
|
-
{
|
40
|
-
delete: coll_name,
|
41
|
-
deletes: validate_updates(connection, send(IDENTIFIER)),
|
42
|
-
ordered: ordered?,
|
43
|
-
}
|
44
|
-
end
|
45
|
-
|
46
|
-
def message(connection)
|
47
|
-
Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,47 +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 Distinct
|
21
|
-
|
22
|
-
# A MongoDB distinct 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
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def selector(connection)
|
36
|
-
selector = spec[:selector]
|
37
|
-
selector = apply_collation(selector, connection, spec[:collation])
|
38
|
-
selector
|
39
|
-
end
|
40
|
-
|
41
|
-
def message(connection)
|
42
|
-
Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,41 +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 Drop
|
21
|
-
|
22
|
-
# A MongoDB drop collection 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 WriteConcernSupported
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def message(connection)
|
36
|
-
Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,41 +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 DropDatabase
|
21
|
-
|
22
|
-
# A MongoDB dropdatabase 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 WriteConcernSupported
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def message(connection)
|
36
|
-
Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,45 +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 DropIndex
|
21
|
-
|
22
|
-
# A MongoDB dropindex 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 WriteConcernSupported
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def selector(connection)
|
36
|
-
{ :dropIndexes => coll_name, :index => index_name }
|
37
|
-
end
|
38
|
-
|
39
|
-
def message(connection)
|
40
|
-
Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,58 +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 Explain
|
21
|
-
|
22
|
-
# A MongoDB explain command operation sent as a command message.
|
23
|
-
#
|
24
|
-
# @api private
|
25
|
-
#
|
26
|
-
# @since 2.0.0
|
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
|
-
if spec[:collation] && !connection.features.collation_enabled?
|
42
|
-
raise Error::UnsupportedCollation
|
43
|
-
end
|
44
|
-
|
45
|
-
{
|
46
|
-
explain: {
|
47
|
-
find: coll_name,
|
48
|
-
}.update(Find::Builder::Command.selector(spec, connection)),
|
49
|
-
}.update(spec[:explain] || {})
|
50
|
-
end
|
51
|
-
|
52
|
-
def message(connection)
|
53
|
-
Protocol::Query.new(db_name, Database::COMMAND, command(connection), options(connection))
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,52 +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 Explain
|
21
|
-
|
22
|
-
# A MongoDB explain command operation sent as a legacy wire protocol message.
|
23
|
-
#
|
24
|
-
# @api private
|
25
|
-
#
|
26
|
-
# @since 2.0.0
|
27
|
-
class Legacy
|
28
|
-
include Specifiable
|
29
|
-
include Executable
|
30
|
-
include ReadPreferenceSupported
|
31
|
-
include PolymorphicResult
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def message(connection)
|
36
|
-
if spec[:collation] && !connection.features.collation_enabled?
|
37
|
-
raise Error::UnsupportedCollation
|
38
|
-
end
|
39
|
-
|
40
|
-
Protocol::Query.new(
|
41
|
-
db_name,
|
42
|
-
coll_name,
|
43
|
-
Find::Builder::Legacy.selector(spec, connection),
|
44
|
-
options(connection).update(
|
45
|
-
Find::Builder::Legacy.query_options(spec, connection),
|
46
|
-
),
|
47
|
-
)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|