mongo 2.5.0.beta → 2.5.0
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/address.rb +1 -1
- data/lib/mongo/address/unix.rb +1 -1
- data/lib/mongo/auth/user.rb +0 -5
- data/lib/mongo/auth/user/view.rb +4 -4
- data/lib/mongo/bulk_write.rb +60 -32
- data/lib/mongo/client.rb +44 -8
- data/lib/mongo/cluster.rb +14 -12
- data/lib/mongo/cluster/periodic_executor.rb +106 -0
- data/lib/mongo/cluster/{cursor_reaper.rb → reapers/cursor_reaper.rb} +5 -37
- data/lib/mongo/cluster/reapers/socket_reaper.rb +59 -0
- data/lib/mongo/collection.rb +9 -6
- data/lib/mongo/collection/view.rb +2 -2
- data/lib/mongo/collection/view/builder/aggregation.rb +2 -1
- data/lib/mongo/collection/view/builder/find_command.rb +1 -1
- data/lib/mongo/collection/view/change_stream.rb +14 -1
- data/lib/mongo/collection/view/map_reduce.rb +30 -13
- data/lib/mongo/collection/view/readable.rb +5 -5
- data/lib/mongo/collection/view/writable.rb +98 -51
- data/lib/mongo/error.rb +3 -0
- data/lib/mongo/error/invalid_txt_record.rb +27 -0
- data/lib/mongo/error/invalid_uri.rb +7 -6
- data/lib/mongo/error/mismatched_domain.rb +27 -0
- data/lib/mongo/error/no_srv_records.rb +26 -0
- data/lib/mongo/error/unsupported_features.rb +0 -18
- data/lib/mongo/index/view.rb +2 -2
- data/lib/mongo/operation.rb +1 -0
- data/lib/mongo/operation/causally_consistent.rb +33 -0
- data/lib/mongo/operation/commands.rb +2 -1
- data/lib/mongo/operation/commands/aggregate.rb +2 -7
- data/lib/mongo/operation/commands/count.rb +27 -0
- data/lib/mongo/operation/commands/distinct.rb +27 -0
- data/lib/mongo/operation/commands/find.rb +3 -1
- data/lib/mongo/operation/commands/map_reduce.rb +1 -0
- data/lib/mongo/operation/commands/parallel_scan.rb +1 -0
- data/lib/mongo/operation/specifiable.rb +12 -0
- data/lib/mongo/operation/uses_command_op_msg.rb +36 -5
- data/lib/mongo/operation/write.rb +0 -5
- data/lib/mongo/operation/write/bulk/bulkable.rb +4 -8
- data/lib/mongo/operation/write/bulk/mergable.rb +2 -0
- data/lib/mongo/operation/write/command/create_index.rb +19 -0
- data/lib/mongo/operation/write/command/create_user.rb +19 -0
- data/lib/mongo/operation/write/command/delete.rb +1 -2
- data/lib/mongo/operation/write/command/drop_index.rb +19 -0
- data/lib/mongo/operation/write/command/insert.rb +1 -2
- data/lib/mongo/operation/write/command/remove_user.rb +19 -0
- data/lib/mongo/operation/write/command/update.rb +1 -2
- data/lib/mongo/operation/write/command/update_user.rb +19 -0
- data/lib/mongo/operation/write/write_command_enabled.rb +1 -3
- data/lib/mongo/protocol/compressed.rb +2 -1
- data/lib/mongo/protocol/serializers.rb +6 -6
- data/lib/mongo/retryable.rb +48 -5
- data/lib/mongo/server.rb +15 -0
- data/lib/mongo/server/connection.rb +21 -1
- data/lib/mongo/server/connection_pool.rb +3 -0
- data/lib/mongo/server/connection_pool/queue.rb +50 -5
- data/lib/mongo/server/description.rb +11 -3
- data/lib/mongo/server/description/features.rb +26 -7
- data/lib/mongo/session.rb +133 -6
- data/lib/mongo/session/server_session.rb +30 -0
- data/lib/mongo/session/session_pool.rb +20 -20
- data/lib/mongo/uri.rb +88 -44
- data/lib/mongo/uri/srv_protocol.rb +158 -0
- data/lib/mongo/version.rb +1 -1
- data/lib/mongo/write_concern/normalizable.rb +12 -0
- data/mongo.gemspec +1 -2
- data/spec/mongo/address_spec.rb +12 -0
- data/spec/mongo/auth/user/view_spec.rb +1 -5
- data/spec/mongo/bulk_write_spec.rb +232 -401
- data/spec/mongo/change_stream_examples_spec.rb +150 -0
- data/spec/mongo/client_spec.rb +142 -2
- data/spec/mongo/cluster/cursor_reaper_spec.rb +0 -70
- data/spec/mongo/cluster/socket_reaper_spec.rb +32 -0
- data/spec/mongo/cluster_spec.rb +11 -7
- data/spec/mongo/collection/view/aggregation_spec.rb +46 -1
- data/spec/mongo/collection/view/builder/find_command_spec.rb +15 -0
- data/spec/mongo/collection/view/change_stream_spec.rb +79 -12
- data/spec/mongo/collection/view/map_reduce_spec.rb +120 -4
- data/spec/mongo/collection/view/readable_spec.rb +23 -5
- data/spec/mongo/collection_spec.rb +292 -102
- data/spec/mongo/command_monitoring_spec.rb +26 -32
- data/spec/mongo/crud_spec.rb +1 -1
- data/spec/mongo/cursor_spec.rb +2 -3
- data/spec/mongo/database_spec.rb +30 -14
- data/spec/mongo/dns_seedlist_discovery_spec.rb +94 -0
- data/spec/mongo/grid/fs_bucket_spec.rb +1 -1
- data/spec/mongo/grid/stream/write_spec.rb +1 -1
- data/spec/mongo/index/view_spec.rb +8 -46
- data/spec/mongo/operation/write/bulk/delete_spec.rb +2 -2
- data/spec/mongo/operation/write/bulk/insert_spec.rb +2 -10
- data/spec/mongo/operation/write/{create_index_spec.rb → command/create_index_spec.rb} +2 -6
- data/spec/mongo/operation/write/command/delete_spec.rb +35 -7
- data/spec/mongo/operation/write/{drop_index_spec.rb → command/drop_index_spec.rb} +1 -1
- data/spec/mongo/operation/write/command/insert_spec.rb +37 -6
- data/spec/mongo/operation/write/{remove_user_spec.rb → command/remove_user_spec.rb} +2 -6
- data/spec/mongo/operation/write/command/update_spec.rb +34 -7
- data/spec/mongo/operation/write/{update_user_spec.rb → command/update_user_spec.rb} +1 -1
- data/spec/mongo/operation/write/create_user_spec.rb +1 -1
- data/spec/mongo/operation/write/delete_spec.rb +1 -1
- data/spec/mongo/operation/write/insert_spec.rb +2 -10
- data/spec/mongo/operation/write/update_spec.rb +3 -15
- data/spec/mongo/retryable_spec.rb +1 -1
- data/spec/mongo/retryable_writes_spec.rb +815 -0
- data/spec/mongo/server/connection_pool/queue_spec.rb +35 -2
- data/spec/mongo/server/connection_pool_spec.rb +234 -1
- data/spec/mongo/server/connection_spec.rb +10 -6
- data/spec/mongo/server/description/features_spec.rb +51 -37
- data/spec/mongo/server/description_spec.rb +6 -3
- data/spec/mongo/server_spec.rb +87 -0
- data/spec/mongo/session/server_session_spec.rb +43 -0
- data/spec/mongo/session/session_pool_spec.rb +63 -27
- data/spec/mongo/session_spec.rb +247 -0
- data/spec/mongo/shell_examples_spec.rb +2 -2
- data/spec/mongo/uri/srv_protocol_spec.rb +933 -0
- data/spec/mongo/uri_spec.rb +42 -3
- data/spec/mongo/write_concern/acknowledged_spec.rb +11 -0
- data/spec/mongo/write_concern/unacknowledged_spec.rb +11 -0
- data/spec/spec_helper.rb +11 -25
- data/spec/support/authorization.rb +2 -1
- data/spec/support/connection_string.rb +8 -4
- data/spec/support/crud.rb +38 -24
- data/spec/support/crud/write.rb +30 -3
- data/spec/support/crud_tests/read/aggregate-out.yml +21 -0
- data/spec/support/crud_tests/write/bulkWrite-arrayFilters.yml +44 -0
- data/spec/support/crud_tests/write/findOneAndUpdate-arrayFilters.yml +1 -1
- data/spec/support/crud_tests/write/insertMany.yml +1 -3
- data/spec/support/crud_tests/write/replaceOne.yml +1 -1
- data/spec/support/crud_tests/write/updateMany-arrayFilters.yml +1 -1
- data/spec/support/crud_tests/write/updateOne-arrayFilters.yml +1 -1
- data/spec/support/dns_seedlist_discovery_tests/longer-parent-in-return.yml +11 -0
- data/spec/support/dns_seedlist_discovery_tests/misformatted-option.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/no-results.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/not-enough-parts.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/one-result-default-port.yml +10 -0
- data/spec/support/dns_seedlist_discovery_tests/one-txt-record-multiple-strings.yml +10 -0
- data/spec/support/dns_seedlist_discovery_tests/one-txt-record.yml +11 -0
- data/spec/support/dns_seedlist_discovery_tests/parent-part-mismatch1.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/parent-part-mismatch2.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/parent-part-mismatch3.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/parent-part-mismatch4.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/parent-part-mismatch5.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/returned-parent-too-short.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/returned-parent-wrong.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/two-results-default-port.yml +11 -0
- data/spec/support/dns_seedlist_discovery_tests/two-results-nonstandard-port.yml +11 -0
- data/spec/support/dns_seedlist_discovery_tests/two-txt-records.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/txt-record-not-allowed-option.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/txt-record-with-overridden-ssl-option.yml +11 -0
- data/spec/support/dns_seedlist_discovery_tests/txt-record-with-overridden-uri-option.yml +11 -0
- data/spec/support/dns_seedlist_discovery_tests/txt-record-with-unallowed-option.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/uri-with-port.yml +5 -0
- data/spec/support/dns_seedlist_discovery_tests/uri-with-two-hosts.yml +5 -0
- data/spec/support/retryable_writes_tests/bulkWrite.yml +305 -0
- data/spec/support/retryable_writes_tests/deleteOne.yml +51 -0
- data/spec/support/retryable_writes_tests/findOneAndDelete.yml +52 -0
- data/spec/support/retryable_writes_tests/findOneAndReplace.yml +57 -0
- data/spec/support/retryable_writes_tests/findOneAndUpdate.yml +56 -0
- data/spec/support/retryable_writes_tests/insertMany.yml +72 -0
- data/spec/support/retryable_writes_tests/insertOne.yml +55 -0
- data/spec/support/retryable_writes_tests/replaceOne.yml +60 -0
- data/spec/support/retryable_writes_tests/updateOne.yml +120 -0
- data/spec/support/shared/session.rb +525 -24
- metadata +437 -350
- metadata.gz.sig +0 -0
- data/lib/mongo/operation/commands/user_query.rb +0 -72
- data/lib/mongo/operation/write/create_index.rb +0 -67
- data/lib/mongo/operation/write/create_user.rb +0 -50
- data/lib/mongo/operation/write/drop_index.rb +0 -63
- data/lib/mongo/operation/write/remove_user.rb +0 -48
- data/lib/mongo/operation/write/update_user.rb +0 -50
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# Copyright (C) 2014-2017 MongoDB, Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
module Mongo
|
16
|
-
module Operation
|
17
|
-
module Commands
|
18
|
-
|
19
|
-
# A MongoDB operation to get info of a particular user in a database.
|
20
|
-
#
|
21
|
-
# @example Create the user query operation.
|
22
|
-
# UserQuery.new(:name => 'emily', :db_name => 'test-db')
|
23
|
-
#
|
24
|
-
# Initialization:
|
25
|
-
# param [ Hash ] spec The specifications for the user query operation.
|
26
|
-
#
|
27
|
-
# option spec :user_name [ String ] The name of the user.
|
28
|
-
# option spec :db_name [ String ] The name of the database where the user exists.
|
29
|
-
# option spec :options [ Hash ] Options for the operation.
|
30
|
-
#
|
31
|
-
# @since 2.1.0
|
32
|
-
class UserQuery
|
33
|
-
include Executable
|
34
|
-
include Specifiable
|
35
|
-
|
36
|
-
# Execute the operation.
|
37
|
-
#
|
38
|
-
# @example Execute the operation.
|
39
|
-
# operation.execute(server)
|
40
|
-
#
|
41
|
-
# @param [ Mongo::Server ] server The server to send this operation to.
|
42
|
-
#
|
43
|
-
# @return [ Result ] The operation response, if there is one.
|
44
|
-
#
|
45
|
-
# @since 2.1.0
|
46
|
-
def execute(server)
|
47
|
-
if server.features.users_info_enabled?
|
48
|
-
UsersInfo.new(spec).execute(server).validate!
|
49
|
-
else
|
50
|
-
server.with_connection do |connection|
|
51
|
-
Result.new(connection.dispatch([ message(server) ])).validate!
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
private
|
57
|
-
|
58
|
-
def selector
|
59
|
-
{ :user => user_name }
|
60
|
-
end
|
61
|
-
|
62
|
-
def query_coll
|
63
|
-
Auth::User::COLLECTION
|
64
|
-
end
|
65
|
-
|
66
|
-
def message(server)
|
67
|
-
Protocol::Query.new(db_name, query_coll, selector, options)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
|
2
|
-
# Copyright (C) 2014-2017 MongoDB, Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
|
16
|
-
module Mongo
|
17
|
-
module Operation
|
18
|
-
module Write
|
19
|
-
|
20
|
-
# A MongoDB create index operation.
|
21
|
-
#
|
22
|
-
# @note If a server with version >= 2.5.5 is being used, a write command
|
23
|
-
# operation will be created and sent instead.
|
24
|
-
#
|
25
|
-
# @example Create the create index operation.
|
26
|
-
# Write::CreateIndex.new({
|
27
|
-
# :index => { :name => 1, :age => -1 },
|
28
|
-
# :db_name => 'test',
|
29
|
-
# :coll_name => 'test_coll',
|
30
|
-
# :index_name => 'name_1_age_-1'
|
31
|
-
# })
|
32
|
-
#
|
33
|
-
# Initialization:
|
34
|
-
# param [ Hash ] spec The specifications for the insert.
|
35
|
-
#
|
36
|
-
# option spec :index [ Hash ] The index spec to create.
|
37
|
-
# option spec :db_name [ String ] The name of the database.
|
38
|
-
# option spec :coll_name [ String ] The name of the collection.
|
39
|
-
# option spec :index_name [ String ] The name of the index.
|
40
|
-
# option spec :options [ Hash ] Options for the command, if it ends up being a
|
41
|
-
# write command.
|
42
|
-
#
|
43
|
-
# @since 2.0.0
|
44
|
-
class CreateIndex
|
45
|
-
include GLE
|
46
|
-
include WriteCommandEnabled
|
47
|
-
include Specifiable
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def write_command_op
|
52
|
-
Command::CreateIndex.new(spec)
|
53
|
-
end
|
54
|
-
|
55
|
-
def index_documents
|
56
|
-
indexes.dup.each do |index|
|
57
|
-
index[:ns] = namespace
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def message(server)
|
62
|
-
Protocol::Insert.new(db_name, Index::COLLECTION, index_documents, validating_keys: false)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
|
2
|
-
# Copyright (C) 2014-2017 MongoDB, Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
|
16
|
-
module Mongo
|
17
|
-
module Operation
|
18
|
-
module Write
|
19
|
-
|
20
|
-
# A MongoDB create user operation.
|
21
|
-
#
|
22
|
-
# @example Initialize the operation.
|
23
|
-
# Write::CreateUser.new(:db_name => 'test', :user => user)
|
24
|
-
#
|
25
|
-
# Initialization:
|
26
|
-
# param [ Hash ] spec The specifications for the create.
|
27
|
-
#
|
28
|
-
# option spec :user [ Auth::User ] The user to create.
|
29
|
-
# option spec :db_name [ String ] The name of the database.
|
30
|
-
#
|
31
|
-
# @since 2.0.0
|
32
|
-
class CreateUser
|
33
|
-
include GLE
|
34
|
-
include WriteCommandEnabled
|
35
|
-
include Specifiable
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def write_command_op
|
40
|
-
Command::CreateUser.new(spec)
|
41
|
-
end
|
42
|
-
|
43
|
-
def message(server)
|
44
|
-
user_spec = { user: user.name }.merge(user.spec)
|
45
|
-
Protocol::Insert.new(db_name, Auth::User::COLLECTION, [ user_spec ])
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# Copyright (C) 2014-2017 MongoDB, Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
module Mongo
|
16
|
-
module Operation
|
17
|
-
module Write
|
18
|
-
|
19
|
-
# A MongoDB drop index operation.
|
20
|
-
#
|
21
|
-
# @example Create the drop index operation.
|
22
|
-
# Write::DropIndex.new({
|
23
|
-
# :db_name => 'test',
|
24
|
-
# :coll_name => 'test_coll',
|
25
|
-
# :index_name => 'name_1_age_-1'
|
26
|
-
# })
|
27
|
-
#
|
28
|
-
# Initialization:
|
29
|
-
# param [ Hash ] spec The specifications for the drop.
|
30
|
-
#
|
31
|
-
# option spec :index [ Hash ] The index spec to create.
|
32
|
-
# option spec :db_name [ String ] The name of the database.
|
33
|
-
# option spec :coll_name [ String ] The name of the collection.
|
34
|
-
# option spec :index_name [ String ] The name of the index.
|
35
|
-
#
|
36
|
-
# @since 2.0.0
|
37
|
-
class DropIndex
|
38
|
-
include WriteCommandEnabled
|
39
|
-
include Specifiable
|
40
|
-
|
41
|
-
# Execute the drop index operation.
|
42
|
-
#
|
43
|
-
# @example Execute the operation.
|
44
|
-
# operation.execute(server)
|
45
|
-
#
|
46
|
-
# @param [ Mongo::Server ] server The server to send this operation to.
|
47
|
-
#
|
48
|
-
# @return [ Result ] The result of the operation.
|
49
|
-
#
|
50
|
-
# @since 2.0.0
|
51
|
-
def execute(server)
|
52
|
-
execute_write_command(server)
|
53
|
-
end
|
54
|
-
|
55
|
-
private
|
56
|
-
|
57
|
-
def write_command_op
|
58
|
-
Command::DropIndex.new(spec)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# Copyright (C) 2014-2017 MongoDB, Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
module Mongo
|
16
|
-
module Operation
|
17
|
-
module Write
|
18
|
-
|
19
|
-
# A MongoDB remove user operation.
|
20
|
-
#
|
21
|
-
# @example Create the remove user operation.
|
22
|
-
# Write::RemoveUser.new(:db_name => 'test', :name => name)
|
23
|
-
#
|
24
|
-
# Initialization:
|
25
|
-
# param [ Hash ] spec The specifications for the remove.
|
26
|
-
#
|
27
|
-
# option spec :name [ String ] The user name.
|
28
|
-
# option spec :db_name [ String ] The name of the database.
|
29
|
-
#
|
30
|
-
# @since 2.0.0
|
31
|
-
class RemoveUser
|
32
|
-
include GLE
|
33
|
-
include WriteCommandEnabled
|
34
|
-
include Specifiable
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def write_command_op
|
39
|
-
Command::RemoveUser.new(spec)
|
40
|
-
end
|
41
|
-
|
42
|
-
def message(server)
|
43
|
-
Protocol::Delete.new(db_name, Auth::User::COLLECTION, { user: user_name })
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
|
2
|
-
# Copyright (C) 2014-2017 MongoDB, Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
|
16
|
-
module Mongo
|
17
|
-
module Operation
|
18
|
-
module Write
|
19
|
-
|
20
|
-
# A MongoDB update user operation.
|
21
|
-
#
|
22
|
-
# @example Initialize the operation.
|
23
|
-
# Write::UpdateUser.new(:db_name => 'test', :user => user)
|
24
|
-
#
|
25
|
-
# Initialization:
|
26
|
-
# param [ Hash ] spec The specifications for the update.
|
27
|
-
#
|
28
|
-
# option spec :user [ Auth::User ] The user to update.
|
29
|
-
# option spec :db_name [ String ] The name of the database.
|
30
|
-
#
|
31
|
-
# @since 2.0.0
|
32
|
-
class UpdateUser
|
33
|
-
include GLE
|
34
|
-
include WriteCommandEnabled
|
35
|
-
include Specifiable
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def write_command_op
|
40
|
-
Command::UpdateUser.new(spec)
|
41
|
-
end
|
42
|
-
|
43
|
-
def message(server)
|
44
|
-
user_spec = { user: user.name }.merge(user.spec)
|
45
|
-
Protocol::Update.new(db_name, Auth::User::COLLECTION, { user: user.name }, user_spec)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|