mongo 1.8.6 → 1.12.5
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/LICENSE +1 -1
- data/README.md +114 -282
- data/Rakefile +18 -4
- data/VERSION +1 -1
- data/bin/mongo_console +27 -5
- data/lib/mongo/bulk_write_collection_view.rb +387 -0
- data/lib/mongo/collection.rb +283 -222
- data/lib/mongo/collection_writer.rb +364 -0
- data/lib/mongo/{util → connection}/node.rb +58 -6
- data/lib/mongo/{util → connection}/pool.rb +61 -37
- data/lib/mongo/{util → connection}/pool_manager.rb +72 -22
- data/lib/mongo/{util → connection}/sharding_pool_manager.rb +13 -0
- data/lib/mongo/connection/socket/socket_util.rb +37 -0
- data/lib/mongo/connection/socket/ssl_socket.rb +95 -0
- data/lib/mongo/connection/socket/tcp_socket.rb +87 -0
- data/lib/mongo/connection/socket/unix_socket.rb +39 -0
- data/lib/mongo/connection/socket.rb +18 -0
- data/lib/mongo/connection.rb +19 -0
- data/lib/mongo/cursor.rb +183 -57
- data/lib/mongo/db.rb +302 -138
- data/lib/mongo/exception.rb +145 -0
- data/lib/mongo/functional/authentication.rb +455 -0
- data/lib/mongo/{util → functional}/logging.rb +23 -7
- data/lib/mongo/functional/read_preference.rb +183 -0
- data/lib/mongo/functional/scram.rb +556 -0
- data/lib/mongo/functional/uri_parser.rb +409 -0
- data/lib/mongo/{util → functional}/write_concern.rb +21 -9
- data/lib/mongo/functional.rb +20 -0
- data/lib/mongo/gridfs/grid.rb +19 -8
- data/lib/mongo/gridfs/grid_ext.rb +14 -0
- data/lib/mongo/gridfs/grid_file_system.rb +17 -4
- data/lib/mongo/gridfs/grid_io.rb +21 -9
- data/lib/mongo/gridfs.rb +18 -0
- data/lib/mongo/legacy.rb +76 -7
- data/lib/mongo/mongo_client.rb +246 -206
- data/lib/mongo/mongo_replica_set_client.rb +65 -15
- data/lib/mongo/mongo_sharded_client.rb +18 -3
- data/lib/mongo/networking.rb +47 -18
- data/lib/mongo/{util → utils}/conversions.rb +18 -3
- data/lib/mongo/{util → utils}/core_ext.rb +15 -32
- data/lib/mongo/{util → utils}/server_version.rb +15 -0
- data/lib/mongo/{util → utils}/support.rb +22 -55
- data/lib/mongo/utils/thread_local_variable_manager.rb +25 -0
- data/lib/mongo/utils.rb +19 -0
- data/lib/mongo.rb +44 -26
- data/mongo.gemspec +2 -2
- data/test/functional/authentication_test.rb +31 -10
- data/test/functional/bulk_api_stress_test.rb +133 -0
- data/test/functional/bulk_write_collection_view_test.rb +1198 -0
- data/test/functional/client_test.rb +627 -0
- data/test/functional/collection_test.rb +1419 -654
- data/test/functional/collection_writer_test.rb +83 -0
- data/test/functional/conversions_test.rb +46 -2
- data/test/functional/cursor_fail_test.rb +17 -9
- data/test/functional/cursor_message_test.rb +28 -15
- data/test/functional/cursor_test.rb +300 -165
- data/test/functional/db_api_test.rb +294 -264
- data/test/functional/db_connection_test.rb +15 -3
- data/test/functional/db_test.rb +165 -99
- data/test/functional/grid_file_system_test.rb +124 -112
- data/test/functional/grid_io_test.rb +17 -3
- data/test/functional/grid_test.rb +16 -2
- data/test/functional/pool_test.rb +99 -10
- data/test/functional/safe_test.rb +18 -4
- data/test/functional/ssl_test.rb +29 -0
- data/test/functional/support_test.rb +14 -0
- data/test/functional/timeout_test.rb +27 -27
- data/test/functional/uri_test.rb +268 -22
- data/test/functional/write_concern_test.rb +19 -5
- data/test/helpers/general.rb +50 -0
- data/test/helpers/test_unit.rb +476 -0
- data/test/replica_set/authentication_test.rb +28 -11
- data/test/replica_set/basic_test.rb +79 -23
- data/test/replica_set/client_test.rb +253 -124
- data/test/replica_set/connection_test.rb +59 -37
- data/test/replica_set/count_test.rb +18 -2
- data/test/replica_set/cursor_test.rb +30 -8
- data/test/replica_set/insert_test.rb +109 -2
- data/test/replica_set/max_values_test.rb +85 -10
- data/test/replica_set/pinning_test.rb +66 -2
- data/test/replica_set/query_test.rb +17 -3
- data/test/replica_set/read_preference_test.rb +115 -96
- data/test/replica_set/refresh_test.rb +59 -9
- data/test/replica_set/replication_ack_test.rb +32 -11
- data/test/replica_set/ssl_test.rb +32 -0
- data/test/sharded_cluster/basic_test.rb +73 -25
- data/test/shared/authentication/basic_auth_shared.rb +260 -0
- data/test/shared/authentication/bulk_api_auth_shared.rb +249 -0
- data/test/shared/authentication/gssapi_shared.rb +176 -0
- data/test/shared/authentication/sasl_plain_shared.rb +96 -0
- data/test/shared/authentication/scram_shared.rb +92 -0
- data/test/shared/ssl_shared.rb +235 -0
- data/test/test_helper.rb +47 -196
- data/test/threading/basic_test.rb +42 -2
- data/test/tools/mongo_config.rb +175 -35
- data/test/tools/mongo_config_test.rb +15 -1
- data/test/unit/client_test.rb +186 -57
- data/test/unit/collection_test.rb +44 -54
- data/test/unit/connection_test.rb +160 -71
- data/test/unit/cursor_test.rb +37 -3
- data/test/unit/db_test.rb +38 -14
- data/test/unit/grid_test.rb +15 -1
- data/test/unit/mongo_sharded_client_test.rb +30 -14
- data/test/unit/node_test.rb +16 -1
- data/test/unit/pool_manager_test.rb +21 -4
- data/test/unit/read_pref_test.rb +386 -1
- data/test/unit/read_test.rb +27 -13
- data/test/unit/safe_test.rb +22 -8
- data/test/unit/sharding_pool_manager_test.rb +25 -4
- data/test/unit/write_concern_test.rb +23 -9
- data.tar.gz.sig +0 -0
- metadata +80 -54
- metadata.gz.sig +0 -0
- data/lib/mongo/exceptions.rb +0 -65
- data/lib/mongo/util/read_preference.rb +0 -112
- data/lib/mongo/util/socket_util.rb +0 -20
- data/lib/mongo/util/ssl_socket.rb +0 -51
- data/lib/mongo/util/tcp_socket.rb +0 -62
- data/lib/mongo/util/thread_local_variable_manager.rb +0 -11
- data/lib/mongo/util/unix_socket.rb +0 -23
- data/lib/mongo/util/uri_parser.rb +0 -337
- data/test/functional/connection_test.rb +0 -449
- data/test/functional/threading_test.rb +0 -95
- data/test/replica_set/complex_connect_test.rb +0 -64
- data/test/shared/authentication.rb +0 -66
- data/test/unit/pool_test.rb +0 -9
- data/test/unit/util_test.rb +0 -55
data/lib/mongo/legacy.rb
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright (C) 2009-2013 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
|
+
|
|
1
15
|
module Mongo
|
|
2
16
|
module LegacyWriteConcern
|
|
3
17
|
@legacy_write_concern = true
|
|
@@ -24,8 +38,8 @@ module Mongo
|
|
|
24
38
|
end
|
|
25
39
|
|
|
26
40
|
module Mongo
|
|
27
|
-
# @deprecated Use Mongo::MongoClient instead. Support will be removed after
|
|
28
|
-
# Please see old documentation for the Connection class
|
|
41
|
+
# @deprecated Use Mongo::MongoClient instead. Support will be removed after
|
|
42
|
+
# v2.0. Please see old documentation for the Connection class.
|
|
29
43
|
class Connection < MongoClient
|
|
30
44
|
include Mongo::LegacyWriteConcern
|
|
31
45
|
|
|
@@ -39,8 +53,9 @@ module Mongo
|
|
|
39
53
|
end
|
|
40
54
|
end
|
|
41
55
|
|
|
42
|
-
# @deprecated Use Mongo::MongoReplicaSetClient instead. Support will be
|
|
43
|
-
# Please see old documentation for the
|
|
56
|
+
# @deprecated Use Mongo::MongoReplicaSetClient instead. Support will be
|
|
57
|
+
# removed after v2.0. Please see old documentation for the
|
|
58
|
+
# ReplSetConnection class.
|
|
44
59
|
class ReplSetConnection < MongoReplicaSetClient
|
|
45
60
|
include Mongo::LegacyWriteConcern
|
|
46
61
|
|
|
@@ -54,8 +69,8 @@ module Mongo
|
|
|
54
69
|
end
|
|
55
70
|
end
|
|
56
71
|
|
|
57
|
-
# @deprecated Use Mongo::MongoShardedClient instead. Support will be removed
|
|
58
|
-
# Please see old documentation for the ShardedConnection class
|
|
72
|
+
# @deprecated Use Mongo::MongoShardedClient instead. Support will be removed
|
|
73
|
+
# after v2.0. Please see old documentation for the ShardedConnection class.
|
|
59
74
|
class ShardedConnection < MongoShardedClient
|
|
60
75
|
include Mongo::LegacyWriteConcern
|
|
61
76
|
|
|
@@ -68,4 +83,58 @@ module Mongo
|
|
|
68
83
|
super
|
|
69
84
|
end
|
|
70
85
|
end
|
|
71
|
-
|
|
86
|
+
|
|
87
|
+
class MongoClient
|
|
88
|
+
# @deprecated This method is no longer in use and never needs to be called
|
|
89
|
+
# directly. Support will be removed after v2.0
|
|
90
|
+
# Authentication of sockets is handled upon checkout and checkin.
|
|
91
|
+
def authenticate_pools
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# @deprecated This method is no longer in use and never needs to be called
|
|
95
|
+
# directly. Support will be removed after v2.0
|
|
96
|
+
# Authentication of sockets is handled upon checkout and checkin.
|
|
97
|
+
def logout_pools(database)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# @deprecated This method is no longer in use and never needs to be called
|
|
101
|
+
# directly. Support will be removed after v2.0
|
|
102
|
+
def apply_saved_authentication
|
|
103
|
+
true
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
class MongoReplicaSetClient
|
|
108
|
+
# @deprecated This method is no longer in use and never needs to be called
|
|
109
|
+
# directly. Support will be removed after v2.0
|
|
110
|
+
# Authentication of sockets is handled upon checkout and checkin.
|
|
111
|
+
def authenticate_pools
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# @deprecated This method is no longer in use and never needs to be called
|
|
115
|
+
# directly. Support will be removed after v2.0
|
|
116
|
+
# Authentication of sockets is handled upon checkout and checkin.
|
|
117
|
+
def logout_pools(database)
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
class DB
|
|
122
|
+
# @deprecated Please use MongoClient#issue_authentication instead. Support
|
|
123
|
+
# will be removed after v2.0
|
|
124
|
+
def issue_authentication(username, password, save_auth=true, opts={})
|
|
125
|
+
auth = Authentication.validate_credentials({
|
|
126
|
+
:db_name => self.name,
|
|
127
|
+
:username => username,
|
|
128
|
+
:password => password
|
|
129
|
+
})
|
|
130
|
+
opts[:save_auth] = save_auth
|
|
131
|
+
@client.issue_authentication(auth, opts)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# @deprecated Please use MongoClient#issue_logout instead. Support will be
|
|
135
|
+
# removed after v2.0
|
|
136
|
+
def issue_logout(opts={})
|
|
137
|
+
@client.issue_logout(self.name, opts)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|