mongo 1.10.0-java
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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/LICENSE +190 -0
- data/README.md +149 -0
- data/Rakefile +31 -0
- data/VERSION +1 -0
- data/bin/mongo_console +43 -0
- data/ext/jsasl/target/jsasl.jar +0 -0
- data/lib/mongo.rb +90 -0
- data/lib/mongo/bulk_write_collection_view.rb +380 -0
- data/lib/mongo/collection.rb +1164 -0
- data/lib/mongo/collection_writer.rb +364 -0
- data/lib/mongo/connection.rb +19 -0
- data/lib/mongo/connection/node.rb +239 -0
- data/lib/mongo/connection/pool.rb +347 -0
- data/lib/mongo/connection/pool_manager.rb +325 -0
- data/lib/mongo/connection/sharding_pool_manager.rb +67 -0
- data/lib/mongo/connection/socket.rb +18 -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 +86 -0
- data/lib/mongo/connection/socket/unix_socket.rb +39 -0
- data/lib/mongo/cursor.rb +719 -0
- data/lib/mongo/db.rb +735 -0
- data/lib/mongo/exception.rb +88 -0
- data/lib/mongo/functional.rb +21 -0
- data/lib/mongo/functional/authentication.rb +318 -0
- data/lib/mongo/functional/logging.rb +85 -0
- data/lib/mongo/functional/read_preference.rb +174 -0
- data/lib/mongo/functional/sasl_java.rb +48 -0
- data/lib/mongo/functional/uri_parser.rb +374 -0
- data/lib/mongo/functional/write_concern.rb +66 -0
- data/lib/mongo/gridfs.rb +18 -0
- data/lib/mongo/gridfs/grid.rb +112 -0
- data/lib/mongo/gridfs/grid_ext.rb +53 -0
- data/lib/mongo/gridfs/grid_file_system.rb +163 -0
- data/lib/mongo/gridfs/grid_io.rb +484 -0
- data/lib/mongo/legacy.rb +140 -0
- data/lib/mongo/mongo_client.rb +702 -0
- data/lib/mongo/mongo_replica_set_client.rb +523 -0
- data/lib/mongo/mongo_sharded_client.rb +159 -0
- data/lib/mongo/networking.rb +370 -0
- data/lib/mongo/utils.rb +19 -0
- data/lib/mongo/utils/conversions.rb +110 -0
- data/lib/mongo/utils/core_ext.rb +70 -0
- data/lib/mongo/utils/server_version.rb +69 -0
- data/lib/mongo/utils/support.rb +80 -0
- data/lib/mongo/utils/thread_local_variable_manager.rb +25 -0
- data/mongo.gemspec +36 -0
- data/test/functional/authentication_test.rb +35 -0
- data/test/functional/bulk_api_stress_test.rb +133 -0
- data/test/functional/bulk_write_collection_view_test.rb +1129 -0
- data/test/functional/client_test.rb +565 -0
- data/test/functional/collection_test.rb +2073 -0
- data/test/functional/collection_writer_test.rb +83 -0
- data/test/functional/conversions_test.rb +163 -0
- data/test/functional/cursor_fail_test.rb +63 -0
- data/test/functional/cursor_message_test.rb +57 -0
- data/test/functional/cursor_test.rb +625 -0
- data/test/functional/db_api_test.rb +819 -0
- data/test/functional/db_connection_test.rb +27 -0
- data/test/functional/db_test.rb +344 -0
- data/test/functional/grid_file_system_test.rb +285 -0
- data/test/functional/grid_io_test.rb +252 -0
- data/test/functional/grid_test.rb +273 -0
- data/test/functional/pool_test.rb +62 -0
- data/test/functional/safe_test.rb +98 -0
- data/test/functional/ssl_test.rb +29 -0
- data/test/functional/support_test.rb +62 -0
- data/test/functional/timeout_test.rb +58 -0
- data/test/functional/uri_test.rb +330 -0
- data/test/functional/write_concern_test.rb +118 -0
- data/test/helpers/general.rb +50 -0
- data/test/helpers/test_unit.rb +317 -0
- data/test/replica_set/authentication_test.rb +35 -0
- data/test/replica_set/basic_test.rb +174 -0
- data/test/replica_set/client_test.rb +341 -0
- data/test/replica_set/complex_connect_test.rb +77 -0
- data/test/replica_set/connection_test.rb +138 -0
- data/test/replica_set/count_test.rb +64 -0
- data/test/replica_set/cursor_test.rb +212 -0
- data/test/replica_set/insert_test.rb +140 -0
- data/test/replica_set/max_values_test.rb +145 -0
- data/test/replica_set/pinning_test.rb +55 -0
- data/test/replica_set/query_test.rb +73 -0
- data/test/replica_set/read_preference_test.rb +214 -0
- data/test/replica_set/refresh_test.rb +175 -0
- data/test/replica_set/replication_ack_test.rb +94 -0
- data/test/replica_set/ssl_test.rb +32 -0
- data/test/sharded_cluster/basic_test.rb +197 -0
- data/test/shared/authentication/basic_auth_shared.rb +286 -0
- data/test/shared/authentication/bulk_api_auth_shared.rb +259 -0
- data/test/shared/authentication/gssapi_shared.rb +164 -0
- data/test/shared/authentication/sasl_plain_shared.rb +96 -0
- data/test/shared/ssl_shared.rb +235 -0
- data/test/test_helper.rb +56 -0
- data/test/threading/basic_test.rb +120 -0
- data/test/tools/mongo_config.rb +608 -0
- data/test/tools/mongo_config_test.rb +160 -0
- data/test/unit/client_test.rb +347 -0
- data/test/unit/collection_test.rb +166 -0
- data/test/unit/connection_test.rb +325 -0
- data/test/unit/cursor_test.rb +299 -0
- data/test/unit/db_test.rb +136 -0
- data/test/unit/grid_test.rb +76 -0
- data/test/unit/mongo_sharded_client_test.rb +48 -0
- data/test/unit/node_test.rb +93 -0
- data/test/unit/pool_manager_test.rb +142 -0
- data/test/unit/read_pref_test.rb +115 -0
- data/test/unit/read_test.rb +159 -0
- data/test/unit/safe_test.rb +158 -0
- data/test/unit/sharding_pool_manager_test.rb +84 -0
- data/test/unit/write_concern_test.rb +175 -0
- metadata +260 -0
- metadata.gz.sig +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
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
|
+
|
|
15
|
+
require 'test_helper'
|
|
16
|
+
|
|
17
|
+
class SafeUnitTest < Test::Unit::TestCase
|
|
18
|
+
|
|
19
|
+
context "Write-Concern modes on Mongo::Connection " do
|
|
20
|
+
setup do
|
|
21
|
+
@safe_value = {:w => 7, :j => false, :fsync => false, :wtimeout => nil}
|
|
22
|
+
@connection = Mongo::Connection.new('localhost', 27017, :safe => @safe_value, :connect => false)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
should "propogate to DB" do
|
|
26
|
+
db = @connection[TEST_DB]
|
|
27
|
+
assert_equal @safe_value[:w], db.write_concern[:w]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
db = @connection.db(TEST_DB)
|
|
31
|
+
assert_equal @safe_value[:w], db.write_concern[:w]
|
|
32
|
+
|
|
33
|
+
db = DB.new(TEST_DB, @connection)
|
|
34
|
+
assert_equal @safe_value[:w], db.write_concern[:w]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
should "allow db override" do
|
|
38
|
+
db = DB.new(TEST_DB, @connection, :safe => false)
|
|
39
|
+
assert_equal 0, db.write_concern[:w]
|
|
40
|
+
|
|
41
|
+
db = @connection.db(TEST_DB, :safe => false)
|
|
42
|
+
assert_equal 0, db.write_concern[:w]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
context "on DB: " do
|
|
46
|
+
setup do
|
|
47
|
+
@db = @connection[TEST_DB]
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
should "propogate to collection" do
|
|
51
|
+
col = @db.collection('bar')
|
|
52
|
+
assert_equal @safe_value, col.write_concern
|
|
53
|
+
|
|
54
|
+
col = @db['bar']
|
|
55
|
+
assert_equal @safe_value, col.write_concern
|
|
56
|
+
|
|
57
|
+
col = Collection.new('bar', @db)
|
|
58
|
+
assert_equal @safe_value, col.write_concern
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
should "allow override on collection" do
|
|
62
|
+
col = @db.collection('bar', :safe => false)
|
|
63
|
+
assert_equal 0, col.write_concern[:w]
|
|
64
|
+
|
|
65
|
+
col = Collection.new('bar', @db, :safe => false)
|
|
66
|
+
assert_equal 0, col.write_concern[:w]
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
context "on operations supporting safe mode" do
|
|
71
|
+
setup do
|
|
72
|
+
@col = @connection[TEST_DB]['bar']
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
should "use default value on insert" do
|
|
76
|
+
@connection.expects(:send_message_with_gle).with do |op, msg, log, n, safe|
|
|
77
|
+
safe == @safe_value
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
@col.insert({:a => 1})
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
should "allow override alternate value on insert" do
|
|
84
|
+
@connection.expects(:send_message_with_gle).with do |op, msg, log, n, safe|
|
|
85
|
+
safe == {:w => 100, :j => false, :fsync => false, :wtimeout => nil}
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
@col.insert({:a => 1}, :safe => {:w => 100})
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
should "allow override to disable on insert" do
|
|
92
|
+
@connection.expects(:send_message)
|
|
93
|
+
@col.insert({:a => 1}, :safe => false)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
should "use default value on update" do
|
|
97
|
+
@connection.expects(:send_message_with_gle).with do |op, msg, log, n, safe|
|
|
98
|
+
safe == @safe_value
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
@col.update({:a => 1}, {:a => 2})
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
should "allow override alternate value on update" do
|
|
105
|
+
@connection.expects(:send_message_with_gle).with do |op, msg, log, n, safe|
|
|
106
|
+
safe == {:w => 100, :j => false, :fsync => false, :wtimeout => nil}
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
@col.update({:a => 1}, {:a => 2}, :safe => {:w => 100})
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
should "allow override to disable on update" do
|
|
113
|
+
@connection.expects(:send_message)
|
|
114
|
+
@col.update({:a => 1}, {:a => 2}, :safe => false)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
should "use default value on save" do
|
|
118
|
+
@connection.expects(:send_message_with_gle).with do |op, msg, log, n, safe|
|
|
119
|
+
safe == @safe_value
|
|
120
|
+
end
|
|
121
|
+
@col.save({:a => 1})
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
should "allow override alternate value on save" do
|
|
125
|
+
@connection.expects(:send_message_with_gle).with do |op, msg, log, n, safe|
|
|
126
|
+
safe == @safe_value.merge(:w => 1)
|
|
127
|
+
end
|
|
128
|
+
@col.save({:a => 1}, :safe => true)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
should "allow override to disable on save" do
|
|
132
|
+
@connection.expects(:send_message)
|
|
133
|
+
@col.save({:a => 1}, :safe => false)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
should "use default value on remove" do
|
|
137
|
+
@connection.expects(:send_message_with_gle).with do |op, msg, log, n, safe|
|
|
138
|
+
safe == @safe_value
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
@col.remove
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
should "allow override alternate value on remove" do
|
|
145
|
+
@connection.expects(:send_message_with_gle).with do |op, msg, log, n, safe|
|
|
146
|
+
safe == {:w => 100, :j => false, :fsync => false, :wtimeout => nil}
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
@col.remove({}, :safe => {:w => 100})
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
should "allow override to disable on remove" do
|
|
153
|
+
@connection.expects(:send_message)
|
|
154
|
+
@col.remove({}, :safe => false)
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
|
|
15
|
+
require 'test_helper'
|
|
16
|
+
include Mongo
|
|
17
|
+
|
|
18
|
+
class ShardingPoolManagerUnitTest < Test::Unit::TestCase
|
|
19
|
+
|
|
20
|
+
context "Initialization: " do
|
|
21
|
+
|
|
22
|
+
setup do
|
|
23
|
+
TCPSocket.stubs(:new).returns(new_mock_socket)
|
|
24
|
+
@db = new_mock_db
|
|
25
|
+
|
|
26
|
+
@client = stub("MongoShardedClient")
|
|
27
|
+
@client.stubs(:connect_timeout).returns(5)
|
|
28
|
+
@client.stubs(:op_timeout).returns(5)
|
|
29
|
+
@client.stubs(:pool_size).returns(2)
|
|
30
|
+
@client.stubs(:pool_timeout).returns(100)
|
|
31
|
+
@client.stubs(:socket_class).returns(TCPSocket)
|
|
32
|
+
@client.stubs(:mongos?).returns(true)
|
|
33
|
+
@client.stubs(:[]).returns(@db)
|
|
34
|
+
@client.stubs(:socket_opts)
|
|
35
|
+
|
|
36
|
+
@client.stubs(:replica_set_name).returns(nil)
|
|
37
|
+
@client.stubs(:log)
|
|
38
|
+
@arbiters = ['localhost:27020']
|
|
39
|
+
@hosts = [
|
|
40
|
+
'localhost:27017',
|
|
41
|
+
'localhost:27018',
|
|
42
|
+
'localhost:27019'
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
@ismaster = {
|
|
46
|
+
'hosts' => @hosts,
|
|
47
|
+
'arbiters' => @arbiters,
|
|
48
|
+
'maxBsonObjectSize' => 1024,
|
|
49
|
+
'maxMessageSizeBytes' => 1024 * 2.5,
|
|
50
|
+
'maxWireVersion' => 1,
|
|
51
|
+
'minWireVersion' => 0
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
should "populate pools correctly" do
|
|
56
|
+
|
|
57
|
+
@db.stubs(:command).returns(
|
|
58
|
+
# First call to get a socket.
|
|
59
|
+
@ismaster.merge({'ismaster' => true}),
|
|
60
|
+
|
|
61
|
+
# Subsequent calls to configure pools.
|
|
62
|
+
@ismaster.merge({'ismaster' => true}),
|
|
63
|
+
@ismaster.merge({'secondary' => true, 'maxBsonObjectSize' => 500}),
|
|
64
|
+
@ismaster.merge({'secondary' => true, 'maxMessageSizeBytes' => 700}),
|
|
65
|
+
@ismaster.merge({'secondary' => true, 'maxWireVersion' => 0}),
|
|
66
|
+
@ismaster.merge({'secondary' => true, 'minWireVersion' => 0}),
|
|
67
|
+
@ismaster.merge({'arbiterOnly' => true})
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
seed = ['localhost:27017']
|
|
71
|
+
manager = Mongo::ShardingPoolManager.new(@client, seed)
|
|
72
|
+
@client.stubs(:local_manager).returns(manager)
|
|
73
|
+
manager.connect
|
|
74
|
+
|
|
75
|
+
formatted_seed = ['localhost', 27017]
|
|
76
|
+
|
|
77
|
+
assert manager.seeds.include? formatted_seed
|
|
78
|
+
assert_equal 500, manager.max_bson_size
|
|
79
|
+
assert_equal 700, manager.max_message_size
|
|
80
|
+
assert_equal 0, manager.max_wire_version
|
|
81
|
+
assert_equal 0, manager.min_wire_version
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,175 @@
|
|
|
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
|
+
|
|
15
|
+
require 'test_helper'
|
|
16
|
+
|
|
17
|
+
class WriteConcernUnitTest < Test::Unit::TestCase
|
|
18
|
+
|
|
19
|
+
context "Write-Concern modes on Mongo::MongoClient " do
|
|
20
|
+
setup do
|
|
21
|
+
@write_concern = {
|
|
22
|
+
:w => 7,
|
|
23
|
+
:j => false,
|
|
24
|
+
:fsync => false,
|
|
25
|
+
:wtimeout => nil
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
class Mongo::MongoClient
|
|
29
|
+
public :build_get_last_error_message, :build_command_message
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
@client =
|
|
33
|
+
MongoClient.new('localhost', 27017,
|
|
34
|
+
@write_concern.merge({:connect => false}))
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
should "propogate to DB" do
|
|
38
|
+
db = @client[TEST_DB]
|
|
39
|
+
assert_equal @write_concern, db.write_concern
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
db = @client.db(TEST_DB)
|
|
43
|
+
assert_equal @write_concern, db.write_concern
|
|
44
|
+
|
|
45
|
+
db = DB.new(TEST_DB, @client)
|
|
46
|
+
assert_equal @write_concern, db.write_concern
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
should "allow db override" do
|
|
50
|
+
db = DB.new(TEST_DB, @client, :w => 0)
|
|
51
|
+
assert_equal 0, db.write_concern[:w]
|
|
52
|
+
|
|
53
|
+
db = @client.db(TEST_DB, :w => 0)
|
|
54
|
+
assert_equal 0, db.write_concern[:w]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
context "on DB: " do
|
|
58
|
+
setup do
|
|
59
|
+
@db = @client[TEST_DB]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
should "propogate to collection" do
|
|
63
|
+
collection = @db.collection('bar')
|
|
64
|
+
assert_equal @write_concern, collection.write_concern
|
|
65
|
+
|
|
66
|
+
collection = @db['bar']
|
|
67
|
+
assert_equal @write_concern, collection.write_concern
|
|
68
|
+
|
|
69
|
+
collection = Collection.new('bar', @db)
|
|
70
|
+
assert_equal @write_concern, collection.write_concern
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
should "allow override on collection" do
|
|
74
|
+
collection = @db.collection('bar', :w => 0)
|
|
75
|
+
assert_equal 0, collection.write_concern[:w]
|
|
76
|
+
|
|
77
|
+
collection = Collection.new('bar', @db, :w => 0)
|
|
78
|
+
assert_equal 0, collection.write_concern[:w]
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
context "on operations supporting 'gle' mode" do
|
|
83
|
+
setup do
|
|
84
|
+
@collection = @client[TEST_DB]['bar']
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
should "not send w = 1 to the server" do
|
|
88
|
+
gle = @client.build_get_last_error_message("fake", {:w => 1})
|
|
89
|
+
assert_equal gle, @client.build_command_message("fake", {:getlasterror => 1})
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
should "use default value on insert" do
|
|
93
|
+
@client.expects(:send_message_with_gle).with do |op, msg, log, n, wc|
|
|
94
|
+
wc == @write_concern
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
@collection.insert({:a => 1})
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
should "allow override alternate value on insert" do
|
|
101
|
+
@client.expects(:send_message_with_gle).with do |op, msg, log, n, wc|
|
|
102
|
+
wc == {:w => 100, :j => false, :fsync => false, :wtimeout => nil}
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
@collection.insert({:a => 1}, {:w => 100})
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
should "allow override to disable on insert" do
|
|
109
|
+
@client.expects(:send_message)
|
|
110
|
+
@collection.insert({:a => 1}, :w => 0)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
should "use default value on update" do
|
|
114
|
+
@client.expects(:send_message_with_gle).with do |op, msg, log, n, wc|
|
|
115
|
+
wc == @write_concern
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
@collection.update({:a => 1}, {:a => 2})
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
should "allow override alternate value on update" do
|
|
122
|
+
@client.expects(:send_message_with_gle).with do |op, msg, log, n, wc|
|
|
123
|
+
wc == {:w => 100, :j => false, :fsync => false, :wtimeout => nil}
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
@collection.update({:a => 1}, {:a => 2}, {:w => 100})
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
should "allow override to disable on update" do
|
|
130
|
+
@client.expects(:send_message)
|
|
131
|
+
@collection.update({:a => 1}, {:a => 2}, :w => 0)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
should "use default value on save" do
|
|
135
|
+
@client.expects(:send_message_with_gle).with do |op, msg, log, n, wc|
|
|
136
|
+
wc == @write_concern
|
|
137
|
+
end
|
|
138
|
+
@collection.save({:a => 1})
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
should "allow override alternate value on save" do
|
|
142
|
+
@client.expects(:send_message_with_gle).with do |op, msg, log, n, wc|
|
|
143
|
+
wc == @write_concern.merge(:w => 1)
|
|
144
|
+
end
|
|
145
|
+
@collection.save({:a => 1}, :w => 1)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
should "allow override to disable on save" do
|
|
149
|
+
@client.expects(:send_message)
|
|
150
|
+
@collection.save({:a => 1}, :w => 0)
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
should "use default value on remove" do
|
|
154
|
+
@client.expects(:send_message_with_gle).with do |op, msg, log, n, wc|
|
|
155
|
+
wc == @write_concern
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
@collection.remove
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
should "allow override alternate value on remove" do
|
|
162
|
+
@client.expects(:send_message_with_gle).with do |op, msg, log, n, wc|
|
|
163
|
+
wc == {:w => 100, :j => false, :fsync => false, :wtimeout => nil}
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
@collection.remove({}, {:w => 100})
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
should "allow override to disable on remove" do
|
|
170
|
+
@client.expects(:send_message)
|
|
171
|
+
@collection.remove({}, :w => 0)
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: mongo
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.10.0
|
|
5
|
+
platform: java
|
|
6
|
+
authors:
|
|
7
|
+
- Emily Stolfo
|
|
8
|
+
- Durran Jordan
|
|
9
|
+
- Gary Murakami
|
|
10
|
+
- Tyler Brock
|
|
11
|
+
- Brandon Black
|
|
12
|
+
autorequire:
|
|
13
|
+
bindir: bin
|
|
14
|
+
cert_chain:
|
|
15
|
+
- |
|
|
16
|
+
-----BEGIN CERTIFICATE-----
|
|
17
|
+
MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRQwEgYDVQQDDAtkcml2
|
|
18
|
+
ZXItcnVieTEVMBMGCgmSJomT8ixkARkWBTEwZ2VuMRMwEQYKCZImiZPyLGQBGRYD
|
|
19
|
+
Y29tMB4XDTE0MDIxOTE1MTEyNloXDTE1MDIxOTE1MTEyNlowQjEUMBIGA1UEAwwL
|
|
20
|
+
ZHJpdmVyLXJ1YnkxFTATBgoJkiaJk/IsZAEZFgUxMGdlbjETMBEGCgmSJomT8ixk
|
|
21
|
+
ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANFdSAa8fRm1
|
|
22
|
+
bAM9za6Z0fAH4g02bqM1NGnw8zJQrE/PFrFfY6IFCT2AsLfOwr1maVm7iU1+kdVI
|
|
23
|
+
IQ+iI/9+E+ArJ+rbGV3dDPQ+SLl3mLT+vXjfjcxMqI2IW6UuVtt2U3Rxd4QU0kdT
|
|
24
|
+
JxmcPYs5fDN6BgYc6XXgUjy3m+Kwha2pGctdciUOwEfOZ4RmNRlEZKCMLRHdFP8j
|
|
25
|
+
4WTnJSGfXDiuoXICJb5yOPOZPuaapPSNXp93QkUdsqdKC32I+KMpKKYGBQ6yisfA
|
|
26
|
+
5MyVPPCzLR1lP5qXVGJPnOqUAkvEUfCahg7EP9tI20qxiXrR6TSEraYhIFXL0EGY
|
|
27
|
+
u8KAcPHm5KkCAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
|
28
|
+
BBYEFFt3WbF+9JpUjAoj62cQBgNb8HzXMCAGA1UdEQQZMBeBFWRyaXZlci1ydWJ5
|
|
29
|
+
QDEwZ2VuLmNvbTAgBgNVHRIEGTAXgRVkcml2ZXItcnVieUAxMGdlbi5jb20wDQYJ
|
|
30
|
+
KoZIhvcNAQEFBQADggEBALGvdxHF+CnH6QO4PeIce3S8EHuHsYiGLk4sWgNGZkjD
|
|
31
|
+
V3C4XjlI8rQZxalwQwcauacOGj9x94flWUXruEF7+rjUtig7OIrQK2+uVg86vl8r
|
|
32
|
+
xy1n2s1d31KsuazEVExe5o19tnVbI9+30P9qPkS+NgaellXpj5c5qnJUGn5BJtzo
|
|
33
|
+
3D001zXpVnuZvCcE/A4fQ+BEM0zm0oOmA/gWIAFrufOL9oYg1881dRZ+kQytF/9c
|
|
34
|
+
JrZM8w8wGbIOeLtoQqa7HB/jOYbTahH7KMNh2LHAbOR93hNIJxVRa4iwxiMQ75tN
|
|
35
|
+
9WUIAJ4AEtjwRg1Bz0OwDo3aucPCBpx77+/FWhv7JYY=
|
|
36
|
+
-----END CERTIFICATE-----
|
|
37
|
+
date: 2014-04-23 00:00:00.000000000 Z
|
|
38
|
+
dependencies:
|
|
39
|
+
- !ruby/object:Gem::Dependency
|
|
40
|
+
name: bson
|
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
42
|
+
requirements:
|
|
43
|
+
- - ~>
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: 1.10.0
|
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
|
47
|
+
requirements:
|
|
48
|
+
- - ~>
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: 1.10.0
|
|
51
|
+
prerelease: false
|
|
52
|
+
type: :runtime
|
|
53
|
+
description: A Ruby driver for MongoDB. For more information about Mongo, see http://www.mongodb.org.
|
|
54
|
+
email: mongodb-dev@googlegroups.com
|
|
55
|
+
executables:
|
|
56
|
+
- mongo_console
|
|
57
|
+
extensions: []
|
|
58
|
+
extra_rdoc_files: []
|
|
59
|
+
files:
|
|
60
|
+
- LICENSE
|
|
61
|
+
- README.md
|
|
62
|
+
- Rakefile
|
|
63
|
+
- VERSION
|
|
64
|
+
- bin/mongo_console
|
|
65
|
+
- ext/jsasl/target/jsasl.jar
|
|
66
|
+
- lib/mongo.rb
|
|
67
|
+
- lib/mongo/bulk_write_collection_view.rb
|
|
68
|
+
- lib/mongo/collection.rb
|
|
69
|
+
- lib/mongo/collection_writer.rb
|
|
70
|
+
- lib/mongo/connection.rb
|
|
71
|
+
- lib/mongo/connection/node.rb
|
|
72
|
+
- lib/mongo/connection/pool.rb
|
|
73
|
+
- lib/mongo/connection/pool_manager.rb
|
|
74
|
+
- lib/mongo/connection/sharding_pool_manager.rb
|
|
75
|
+
- lib/mongo/connection/socket.rb
|
|
76
|
+
- lib/mongo/connection/socket/socket_util.rb
|
|
77
|
+
- lib/mongo/connection/socket/ssl_socket.rb
|
|
78
|
+
- lib/mongo/connection/socket/tcp_socket.rb
|
|
79
|
+
- lib/mongo/connection/socket/unix_socket.rb
|
|
80
|
+
- lib/mongo/cursor.rb
|
|
81
|
+
- lib/mongo/db.rb
|
|
82
|
+
- lib/mongo/exception.rb
|
|
83
|
+
- lib/mongo/functional.rb
|
|
84
|
+
- lib/mongo/functional/authentication.rb
|
|
85
|
+
- lib/mongo/functional/logging.rb
|
|
86
|
+
- lib/mongo/functional/read_preference.rb
|
|
87
|
+
- lib/mongo/functional/sasl_java.rb
|
|
88
|
+
- lib/mongo/functional/uri_parser.rb
|
|
89
|
+
- lib/mongo/functional/write_concern.rb
|
|
90
|
+
- lib/mongo/gridfs.rb
|
|
91
|
+
- lib/mongo/gridfs/grid.rb
|
|
92
|
+
- lib/mongo/gridfs/grid_ext.rb
|
|
93
|
+
- lib/mongo/gridfs/grid_file_system.rb
|
|
94
|
+
- lib/mongo/gridfs/grid_io.rb
|
|
95
|
+
- lib/mongo/legacy.rb
|
|
96
|
+
- lib/mongo/mongo_client.rb
|
|
97
|
+
- lib/mongo/mongo_replica_set_client.rb
|
|
98
|
+
- lib/mongo/mongo_sharded_client.rb
|
|
99
|
+
- lib/mongo/networking.rb
|
|
100
|
+
- lib/mongo/utils.rb
|
|
101
|
+
- lib/mongo/utils/conversions.rb
|
|
102
|
+
- lib/mongo/utils/core_ext.rb
|
|
103
|
+
- lib/mongo/utils/server_version.rb
|
|
104
|
+
- lib/mongo/utils/support.rb
|
|
105
|
+
- lib/mongo/utils/thread_local_variable_manager.rb
|
|
106
|
+
- mongo.gemspec
|
|
107
|
+
- test/functional/authentication_test.rb
|
|
108
|
+
- test/functional/bulk_api_stress_test.rb
|
|
109
|
+
- test/functional/bulk_write_collection_view_test.rb
|
|
110
|
+
- test/functional/client_test.rb
|
|
111
|
+
- test/functional/collection_test.rb
|
|
112
|
+
- test/functional/collection_writer_test.rb
|
|
113
|
+
- test/functional/conversions_test.rb
|
|
114
|
+
- test/functional/cursor_fail_test.rb
|
|
115
|
+
- test/functional/cursor_message_test.rb
|
|
116
|
+
- test/functional/cursor_test.rb
|
|
117
|
+
- test/functional/db_api_test.rb
|
|
118
|
+
- test/functional/db_connection_test.rb
|
|
119
|
+
- test/functional/db_test.rb
|
|
120
|
+
- test/functional/grid_file_system_test.rb
|
|
121
|
+
- test/functional/grid_io_test.rb
|
|
122
|
+
- test/functional/grid_test.rb
|
|
123
|
+
- test/functional/pool_test.rb
|
|
124
|
+
- test/functional/safe_test.rb
|
|
125
|
+
- test/functional/ssl_test.rb
|
|
126
|
+
- test/functional/support_test.rb
|
|
127
|
+
- test/functional/timeout_test.rb
|
|
128
|
+
- test/functional/uri_test.rb
|
|
129
|
+
- test/functional/write_concern_test.rb
|
|
130
|
+
- test/helpers/general.rb
|
|
131
|
+
- test/helpers/test_unit.rb
|
|
132
|
+
- test/replica_set/authentication_test.rb
|
|
133
|
+
- test/replica_set/basic_test.rb
|
|
134
|
+
- test/replica_set/client_test.rb
|
|
135
|
+
- test/replica_set/complex_connect_test.rb
|
|
136
|
+
- test/replica_set/connection_test.rb
|
|
137
|
+
- test/replica_set/count_test.rb
|
|
138
|
+
- test/replica_set/cursor_test.rb
|
|
139
|
+
- test/replica_set/insert_test.rb
|
|
140
|
+
- test/replica_set/max_values_test.rb
|
|
141
|
+
- test/replica_set/pinning_test.rb
|
|
142
|
+
- test/replica_set/query_test.rb
|
|
143
|
+
- test/replica_set/read_preference_test.rb
|
|
144
|
+
- test/replica_set/refresh_test.rb
|
|
145
|
+
- test/replica_set/replication_ack_test.rb
|
|
146
|
+
- test/replica_set/ssl_test.rb
|
|
147
|
+
- test/sharded_cluster/basic_test.rb
|
|
148
|
+
- test/shared/authentication/basic_auth_shared.rb
|
|
149
|
+
- test/shared/authentication/bulk_api_auth_shared.rb
|
|
150
|
+
- test/shared/authentication/gssapi_shared.rb
|
|
151
|
+
- test/shared/authentication/sasl_plain_shared.rb
|
|
152
|
+
- test/shared/ssl_shared.rb
|
|
153
|
+
- test/test_helper.rb
|
|
154
|
+
- test/threading/basic_test.rb
|
|
155
|
+
- test/tools/mongo_config.rb
|
|
156
|
+
- test/tools/mongo_config_test.rb
|
|
157
|
+
- test/unit/client_test.rb
|
|
158
|
+
- test/unit/collection_test.rb
|
|
159
|
+
- test/unit/connection_test.rb
|
|
160
|
+
- test/unit/cursor_test.rb
|
|
161
|
+
- test/unit/db_test.rb
|
|
162
|
+
- test/unit/grid_test.rb
|
|
163
|
+
- test/unit/mongo_sharded_client_test.rb
|
|
164
|
+
- test/unit/node_test.rb
|
|
165
|
+
- test/unit/pool_manager_test.rb
|
|
166
|
+
- test/unit/read_pref_test.rb
|
|
167
|
+
- test/unit/read_test.rb
|
|
168
|
+
- test/unit/safe_test.rb
|
|
169
|
+
- test/unit/sharding_pool_manager_test.rb
|
|
170
|
+
- test/unit/write_concern_test.rb
|
|
171
|
+
homepage: http://www.mongodb.org
|
|
172
|
+
licenses:
|
|
173
|
+
- Apache License Version 2.0
|
|
174
|
+
metadata: {}
|
|
175
|
+
post_install_message:
|
|
176
|
+
rdoc_options: []
|
|
177
|
+
require_paths:
|
|
178
|
+
- lib
|
|
179
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
180
|
+
requirements:
|
|
181
|
+
- - '>='
|
|
182
|
+
- !ruby/object:Gem::Version
|
|
183
|
+
version: '0'
|
|
184
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
|
+
requirements:
|
|
186
|
+
- - '>='
|
|
187
|
+
- !ruby/object:Gem::Version
|
|
188
|
+
version: '0'
|
|
189
|
+
requirements: []
|
|
190
|
+
rubyforge_project: mongo
|
|
191
|
+
rubygems_version: 2.2.2
|
|
192
|
+
signing_key:
|
|
193
|
+
specification_version: 4
|
|
194
|
+
summary: Ruby driver for MongoDB
|
|
195
|
+
test_files:
|
|
196
|
+
- test/test_helper.rb
|
|
197
|
+
- test/functional/authentication_test.rb
|
|
198
|
+
- test/functional/bulk_api_stress_test.rb
|
|
199
|
+
- test/functional/bulk_write_collection_view_test.rb
|
|
200
|
+
- test/functional/client_test.rb
|
|
201
|
+
- test/functional/collection_test.rb
|
|
202
|
+
- test/functional/collection_writer_test.rb
|
|
203
|
+
- test/functional/conversions_test.rb
|
|
204
|
+
- test/functional/cursor_fail_test.rb
|
|
205
|
+
- test/functional/cursor_message_test.rb
|
|
206
|
+
- test/functional/cursor_test.rb
|
|
207
|
+
- test/functional/db_api_test.rb
|
|
208
|
+
- test/functional/db_connection_test.rb
|
|
209
|
+
- test/functional/db_test.rb
|
|
210
|
+
- test/functional/grid_file_system_test.rb
|
|
211
|
+
- test/functional/grid_io_test.rb
|
|
212
|
+
- test/functional/grid_test.rb
|
|
213
|
+
- test/functional/pool_test.rb
|
|
214
|
+
- test/functional/safe_test.rb
|
|
215
|
+
- test/functional/ssl_test.rb
|
|
216
|
+
- test/functional/support_test.rb
|
|
217
|
+
- test/functional/timeout_test.rb
|
|
218
|
+
- test/functional/uri_test.rb
|
|
219
|
+
- test/functional/write_concern_test.rb
|
|
220
|
+
- test/helpers/general.rb
|
|
221
|
+
- test/helpers/test_unit.rb
|
|
222
|
+
- test/replica_set/authentication_test.rb
|
|
223
|
+
- test/replica_set/basic_test.rb
|
|
224
|
+
- test/replica_set/client_test.rb
|
|
225
|
+
- test/replica_set/complex_connect_test.rb
|
|
226
|
+
- test/replica_set/connection_test.rb
|
|
227
|
+
- test/replica_set/count_test.rb
|
|
228
|
+
- test/replica_set/cursor_test.rb
|
|
229
|
+
- test/replica_set/insert_test.rb
|
|
230
|
+
- test/replica_set/max_values_test.rb
|
|
231
|
+
- test/replica_set/pinning_test.rb
|
|
232
|
+
- test/replica_set/query_test.rb
|
|
233
|
+
- test/replica_set/read_preference_test.rb
|
|
234
|
+
- test/replica_set/refresh_test.rb
|
|
235
|
+
- test/replica_set/replication_ack_test.rb
|
|
236
|
+
- test/replica_set/ssl_test.rb
|
|
237
|
+
- test/sharded_cluster/basic_test.rb
|
|
238
|
+
- test/shared/ssl_shared.rb
|
|
239
|
+
- test/shared/authentication/basic_auth_shared.rb
|
|
240
|
+
- test/shared/authentication/bulk_api_auth_shared.rb
|
|
241
|
+
- test/shared/authentication/gssapi_shared.rb
|
|
242
|
+
- test/shared/authentication/sasl_plain_shared.rb
|
|
243
|
+
- test/threading/basic_test.rb
|
|
244
|
+
- test/tools/mongo_config.rb
|
|
245
|
+
- test/tools/mongo_config_test.rb
|
|
246
|
+
- test/unit/client_test.rb
|
|
247
|
+
- test/unit/collection_test.rb
|
|
248
|
+
- test/unit/connection_test.rb
|
|
249
|
+
- test/unit/cursor_test.rb
|
|
250
|
+
- test/unit/db_test.rb
|
|
251
|
+
- test/unit/grid_test.rb
|
|
252
|
+
- test/unit/mongo_sharded_client_test.rb
|
|
253
|
+
- test/unit/node_test.rb
|
|
254
|
+
- test/unit/pool_manager_test.rb
|
|
255
|
+
- test/unit/read_pref_test.rb
|
|
256
|
+
- test/unit/read_test.rb
|
|
257
|
+
- test/unit/safe_test.rb
|
|
258
|
+
- test/unit/sharding_pool_manager_test.rb
|
|
259
|
+
- test/unit/write_concern_test.rb
|
|
260
|
+
has_rdoc: yard
|