mongo 0.19.3 → 0.20
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.
- data/README.rdoc +7 -3
- data/Rakefile +16 -6
- data/bin/bson_benchmark.rb +2 -2
- data/examples/gridfs.rb +3 -2
- data/lib/mongo.rb +3 -26
- data/lib/mongo/collection.rb +69 -50
- data/lib/mongo/connection.rb +16 -41
- data/lib/mongo/cursor.rb +22 -32
- data/lib/mongo/db.rb +13 -5
- data/lib/mongo/exceptions.rb +11 -15
- data/lib/mongo/gridfs/grid.rb +14 -3
- data/lib/mongo/gridfs/grid_file_system.rb +28 -5
- data/lib/mongo/gridfs/grid_io.rb +42 -24
- data/lib/mongo/util/support.rb +13 -2
- data/mongo-ruby-driver.gemspec +3 -1
- data/test/collection_test.rb +62 -9
- data/test/connection_test.rb +21 -32
- data/test/conversions_test.rb +1 -1
- data/test/cursor_test.rb +2 -2
- data/test/db_api_test.rb +28 -27
- data/test/db_connection_test.rb +1 -1
- data/test/db_test.rb +23 -13
- data/test/grid_file_system_test.rb +30 -4
- data/test/grid_io_test.rb +14 -1
- data/test/grid_test.rb +59 -3
- data/test/test_helper.rb +4 -1
- data/test/threading/test_threading_large_pool.rb +1 -1
- data/test/threading_test.rb +1 -1
- data/test/unit/collection_test.rb +2 -2
- data/test/unit/cursor_test.rb +7 -0
- data/test/unit/db_test.rb +8 -8
- metadata +6 -46
- data/bin/gr.rb +0 -14
- data/lib/bson.rb +0 -46
- data/lib/bson/bson_c.rb +0 -20
- data/lib/bson/bson_ruby.rb +0 -601
- data/lib/bson/byte_buffer.rb +0 -224
- data/lib/bson/exceptions.rb +0 -39
- data/lib/bson/ordered_hash.rb +0 -140
- data/lib/bson/types/binary.rb +0 -54
- data/lib/bson/types/code.rb +0 -36
- data/lib/bson/types/dbref.rb +0 -40
- data/lib/bson/types/min_max_keys.rb +0 -58
- data/lib/bson/types/objectid.rb +0 -180
- data/lib/bson/types/regexp_of_holding.rb +0 -45
- data/lib/mongo/gridfs.rb +0 -29
- data/lib/mongo/gridfs/chunk.rb +0 -91
- data/lib/mongo/gridfs/grid_store.rb +0 -580
- data/lib/mongo/types/binary.rb +0 -52
- data/lib/mongo/types/code.rb +0 -36
- data/lib/mongo/types/dbref.rb +0 -40
- data/lib/mongo/types/min_max_keys.rb +0 -58
- data/lib/mongo/types/objectid.rb +0 -180
- data/lib/mongo/types/regexp_of_holding.rb +0 -45
- data/lib/mongo/util/bson_c.rb +0 -18
- data/lib/mongo/util/bson_ruby.rb +0 -606
- data/lib/mongo/util/byte_buffer.rb +0 -222
- data/lib/mongo/util/ordered_hash.rb +0 -140
- data/test/binary_test.rb +0 -15
- data/test/bson_test.rb +0 -459
- data/test/byte_buffer_test.rb +0 -81
- data/test/chunk_test.rb +0 -82
- data/test/grid_store_test.rb +0 -337
- data/test/objectid_test.rb +0 -125
- data/test/ordered_hash_test.rb +0 -172
data/test/db_connection_test.rb
CHANGED
@@ -8,7 +8,7 @@ class DBConnectionTest < Test::Unit::TestCase
|
|
8
8
|
def test_no_exceptions
|
9
9
|
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
10
10
|
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Connection::DEFAULT_PORT
|
11
|
-
db = Connection.new(host, port).db(
|
11
|
+
db = Connection.new(host, port).db(MONGO_TEST_DB)
|
12
12
|
coll = db.collection('test')
|
13
13
|
coll.remove
|
14
14
|
db.error
|
data/test/db_test.rb
CHANGED
@@ -5,7 +5,7 @@ require 'logger'
|
|
5
5
|
|
6
6
|
class TestPKFactory
|
7
7
|
def create_pk(row)
|
8
|
-
row['_id'] ||=
|
8
|
+
row['_id'] ||= BSON::ObjectID.new
|
9
9
|
row
|
10
10
|
end
|
11
11
|
end
|
@@ -18,8 +18,9 @@ class DBTest < Test::Unit::TestCase
|
|
18
18
|
@@host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
19
19
|
@@port = ENV['MONGO_RUBY_DRIVER_PORT'] || Connection::DEFAULT_PORT
|
20
20
|
@@conn = Connection.new(@@host, @@port)
|
21
|
-
@@db = @@conn.db(
|
21
|
+
@@db = @@conn.db(MONGO_TEST_DB)
|
22
22
|
@@users = @@db.collection('system.users')
|
23
|
+
@@version = @@conn.server_version
|
23
24
|
|
24
25
|
def test_close
|
25
26
|
@@conn.close
|
@@ -30,7 +31,7 @@ class DBTest < Test::Unit::TestCase
|
|
30
31
|
rescue => ex
|
31
32
|
assert_match /NilClass/, ex.to_s
|
32
33
|
ensure
|
33
|
-
@@db = Connection.new(@@host, @@port).db(
|
34
|
+
@@db = Connection.new(@@host, @@port).db(MONGO_TEST_DB)
|
34
35
|
@@users = @@db.collection('system.users')
|
35
36
|
end
|
36
37
|
end
|
@@ -48,7 +49,7 @@ class DBTest < Test::Unit::TestCase
|
|
48
49
|
|
49
50
|
def test_full_coll_name
|
50
51
|
coll = @@db.collection('test')
|
51
|
-
assert_equal
|
52
|
+
assert_equal "#{MONGO_TEST_DB}.test", @@db.full_collection_name(coll.name)
|
52
53
|
end
|
53
54
|
|
54
55
|
def test_collection_names
|
@@ -78,19 +79,19 @@ class DBTest < Test::Unit::TestCase
|
|
78
79
|
def test_pair
|
79
80
|
@@conn.close
|
80
81
|
@@users = nil
|
81
|
-
@@conn = Connection.
|
82
|
-
@@db = @@conn[
|
82
|
+
@@conn = Connection.paired([["this-should-fail", 27017], [@@host, @@port]])
|
83
|
+
@@db = @@conn[MONGO_TEST_DB]
|
83
84
|
assert @@conn.connected?
|
84
85
|
ensure
|
85
86
|
unless @@conn.connected?
|
86
|
-
@@conn = Connection.new(@@host, @@port)
|
87
|
-
@@db = @@conn.db(
|
87
|
+
@@conn = Connection.new(@@host, @@port)
|
88
|
+
@@db = @@conn.db(MONGO_TEST_DB)
|
88
89
|
end
|
89
90
|
@@users = @@db.collection('system.users')
|
90
91
|
end
|
91
92
|
|
92
93
|
def test_pk_factory
|
93
|
-
db = Connection.new(@@host, @@port).db(
|
94
|
+
db = Connection.new(@@host, @@port).db(MONGO_TEST_DB, :pk => TestPKFactory.new)
|
94
95
|
coll = db.collection('test')
|
95
96
|
coll.remove
|
96
97
|
|
@@ -101,7 +102,7 @@ class DBTest < Test::Unit::TestCase
|
|
101
102
|
assert_not_nil oid
|
102
103
|
assert_equal insert_id, oid
|
103
104
|
|
104
|
-
oid = ObjectID.new
|
105
|
+
oid = BSON::ObjectID.new
|
105
106
|
data = {'_id' => oid, 'name' => 'Barney', 'age' => 41}
|
106
107
|
coll.insert(data)
|
107
108
|
row = coll.find_one({'name' => data['name']})
|
@@ -114,7 +115,7 @@ class DBTest < Test::Unit::TestCase
|
|
114
115
|
|
115
116
|
def test_pk_factory_reset
|
116
117
|
conn = Connection.new(@@host, @@port)
|
117
|
-
db = conn.db(
|
118
|
+
db = conn.db(MONGO_TEST_DB)
|
118
119
|
db.pk_factory = Object.new # first time
|
119
120
|
begin
|
120
121
|
db.pk_factory = Object.new
|
@@ -202,7 +203,7 @@ class DBTest < Test::Unit::TestCase
|
|
202
203
|
|
203
204
|
def test_text_port_number_raises_no_errors
|
204
205
|
conn = Connection.new(@@host, @@port.to_s)
|
205
|
-
db = conn[
|
206
|
+
db = conn[MONGO_TEST_DB]
|
206
207
|
assert db.collection('users').remove
|
207
208
|
end
|
208
209
|
|
@@ -220,9 +221,18 @@ class DBTest < Test::Unit::TestCase
|
|
220
221
|
assert !@@db.remove_user("joe")
|
221
222
|
end
|
222
223
|
|
224
|
+
|
225
|
+
if @@version >= "1.3.5"
|
226
|
+
def test_db_stats
|
227
|
+
stats = @@db.stats
|
228
|
+
assert stats.has_key?('collections')
|
229
|
+
assert stats.has_key?('dataSize')
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
223
233
|
context "database profiling" do
|
224
234
|
setup do
|
225
|
-
@db = @@conn[
|
235
|
+
@db = @@conn[MONGO_TEST_DB]
|
226
236
|
@coll = @db['test']
|
227
237
|
@coll.remove
|
228
238
|
@r1 = @coll.insert('a' => 1) # collection not created until it's used
|
@@ -6,7 +6,7 @@ class GridFileSystemTest < Test::Unit::TestCase
|
|
6
6
|
setup do
|
7
7
|
@con = Connection.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
|
8
8
|
ENV['MONGO_RUBY_DRIVER_PORT'] || Connection::DEFAULT_PORT)
|
9
|
-
@db = @con.db(
|
9
|
+
@db = @con.db(MONGO_TEST_DB)
|
10
10
|
end
|
11
11
|
|
12
12
|
teardown do
|
@@ -30,6 +30,14 @@ class GridFileSystemTest < Test::Unit::TestCase
|
|
30
30
|
assert_equal data.length, @chunks_data.length
|
31
31
|
end
|
32
32
|
|
33
|
+
should "have a unique index on chunks" do
|
34
|
+
assert @db['fs.chunks'].index_information['files_id_1_n_1']['unique']
|
35
|
+
end
|
36
|
+
|
37
|
+
should "have an index on filename" do
|
38
|
+
assert @db['fs.files'].index_information['filename_1_uploadDate_-1']
|
39
|
+
end
|
40
|
+
|
33
41
|
should "return an empty string if length is zero" do
|
34
42
|
data = @grid.open('sample.file', 'r') { |f| f.read(0) }
|
35
43
|
assert_equal '', data
|
@@ -75,9 +83,15 @@ class GridFileSystemTest < Test::Unit::TestCase
|
|
75
83
|
assert_equal data.length, @data.length
|
76
84
|
end
|
77
85
|
|
86
|
+
should "raise exception if file not found" do
|
87
|
+
assert_raise GridFileNotFound do
|
88
|
+
@grid.open('io', 'r') { |f| f.write('hello') }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
78
92
|
should "raise exception if not opened for write" do
|
79
93
|
assert_raise GridError do
|
80
|
-
@grid.open('
|
94
|
+
@grid.open('sample', 'r') { |f| f.write('hello') }
|
81
95
|
end
|
82
96
|
end
|
83
97
|
|
@@ -109,9 +123,9 @@ class GridFileSystemTest < Test::Unit::TestCase
|
|
109
123
|
context "and on a second overwrite" do
|
110
124
|
setup do
|
111
125
|
sleep(2)
|
112
|
-
new_data = "NEW" * 1000
|
126
|
+
@new_data = "NEW" * 1000
|
113
127
|
@grid.open('sample', 'w') do |f|
|
114
|
-
f.write new_data
|
128
|
+
f.write @new_data
|
115
129
|
end
|
116
130
|
|
117
131
|
@ids = @db['fs.files'].find({'filename' => 'sample'}).map {|file| file['_id']}
|
@@ -127,6 +141,18 @@ class GridFileSystemTest < Test::Unit::TestCase
|
|
127
141
|
assert_equal 0, @db['fs.files'].find({'filename' => 'sample'}).count
|
128
142
|
assert_equal 0, @db['fs.chunks'].find({'files_id' => {'$in' => @ids}}).count
|
129
143
|
end
|
144
|
+
|
145
|
+
should "delete old versions on write with :delete_old is passed in" do
|
146
|
+
@grid.open('sample', 'w', :delete_old => true) do |f|
|
147
|
+
f.write @new_data
|
148
|
+
end
|
149
|
+
@new_ids = @db['fs.files'].find({'filename' => 'sample'}).map {|file| file['_id']}
|
150
|
+
assert_equal 1, @new_ids.length
|
151
|
+
id = @new_ids.first
|
152
|
+
assert !@ids.include?(id)
|
153
|
+
assert_equal 1, @db['fs.files'].find({'filename' => 'sample'}).count
|
154
|
+
assert_equal 1, @db['fs.chunks'].find({'files_id' => id}).count
|
155
|
+
end
|
130
156
|
end
|
131
157
|
end
|
132
158
|
end
|
data/test/grid_io_test.rb
CHANGED
@@ -6,7 +6,7 @@ class GridIOTest < Test::Unit::TestCase
|
|
6
6
|
context "GridIO" do
|
7
7
|
setup do
|
8
8
|
@db ||= Connection.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
|
9
|
-
ENV['MONGO_RUBY_DRIVER_PORT'] || Connection::DEFAULT_PORT).db(
|
9
|
+
ENV['MONGO_RUBY_DRIVER_PORT'] || Connection::DEFAULT_PORT).db(MONGO_TEST_DB)
|
10
10
|
@files = @db.collection('fs.files')
|
11
11
|
@chunks = @db.collection('fs.chunks')
|
12
12
|
@chunks.create_index([['files_id', Mongo::ASCENDING], ['n', Mongo::ASCENDING]])
|
@@ -49,6 +49,19 @@ class GridIOTest < Test::Unit::TestCase
|
|
49
49
|
assert file.close
|
50
50
|
assert_equal file.server_md5, file.client_md5
|
51
51
|
end
|
52
|
+
|
53
|
+
should "raise an exception when check fails" do
|
54
|
+
io = File.open(File.join(File.dirname(__FILE__), 'data', 'sample_file.pdf'), 'r')
|
55
|
+
db = mock()
|
56
|
+
db.stubs(:command).returns({'md5' => '12345'})
|
57
|
+
@files.expects(:db).returns(db)
|
58
|
+
file = GridIO.new(@files, @chunks, 'bigfile', 'w', :safe => true)
|
59
|
+
file.write(io)
|
60
|
+
assert_raise GridMD5Failure do
|
61
|
+
assert file.close
|
62
|
+
end
|
63
|
+
assert_not_equal file.server_md5, file.client_md5
|
64
|
+
end
|
52
65
|
end
|
53
66
|
|
54
67
|
context "Content types" do
|
data/test/grid_test.rb
CHANGED
@@ -5,7 +5,7 @@ class GridTest < Test::Unit::TestCase
|
|
5
5
|
context "Tests:" do
|
6
6
|
setup do
|
7
7
|
@db ||= Connection.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
|
8
|
-
ENV['MONGO_RUBY_DRIVER_PORT'] || Connection::DEFAULT_PORT).db(
|
8
|
+
ENV['MONGO_RUBY_DRIVER_PORT'] || Connection::DEFAULT_PORT).db(MONGO_TEST_DB)
|
9
9
|
@files = @db.collection('test-fs.files')
|
10
10
|
@chunks = @db.collection('test-fs.chunks')
|
11
11
|
end
|
@@ -27,6 +27,10 @@ class GridTest < Test::Unit::TestCase
|
|
27
27
|
assert_equal @data, data
|
28
28
|
end
|
29
29
|
|
30
|
+
should "have a unique index on chunks" do
|
31
|
+
assert @chunks.index_information['files_id_1_n_1']['unique']
|
32
|
+
end
|
33
|
+
|
30
34
|
should "store the filename" do
|
31
35
|
file = @grid.get(@id)
|
32
36
|
assert_equal 'sample', file.filename
|
@@ -39,13 +43,66 @@ class GridTest < Test::Unit::TestCase
|
|
39
43
|
|
40
44
|
should "delete the file and any chunks" do
|
41
45
|
@grid.delete(@id)
|
42
|
-
assert_raise
|
46
|
+
assert_raise GridFileNotFound do
|
43
47
|
@grid.get(@id)
|
44
48
|
end
|
45
49
|
assert_equal nil, @db['test-fs']['chunks'].find_one({:files_id => @id})
|
46
50
|
end
|
47
51
|
end
|
48
52
|
|
53
|
+
context "Filename not required" do
|
54
|
+
setup do
|
55
|
+
@data = "GRIDDATA" * 50000
|
56
|
+
@grid = Grid.new(@db, 'test-fs')
|
57
|
+
@metadata = {'app' => 'photos'}
|
58
|
+
end
|
59
|
+
|
60
|
+
should "store the file with the old filename api" do
|
61
|
+
id = @grid.put(@data, 'sample', :metadata => @metadata)
|
62
|
+
file = @grid.get(id)
|
63
|
+
assert_equal 'sample', file.filename
|
64
|
+
assert_equal @metadata, file.metadata
|
65
|
+
end
|
66
|
+
|
67
|
+
should "store without a filename" do
|
68
|
+
id = @grid.put(@data, :metadata => @metadata)
|
69
|
+
file = @grid.get(id)
|
70
|
+
assert_nil file.filename
|
71
|
+
file_doc = @files.find_one({'_id' => id})
|
72
|
+
assert !file_doc.has_key?('filename')
|
73
|
+
assert_equal @metadata, file.metadata
|
74
|
+
end
|
75
|
+
|
76
|
+
should "store with filename and metadata with the new api" do
|
77
|
+
id = @grid.put(@data, :filename => 'sample', :metadata => @metadata)
|
78
|
+
file = @grid.get(id)
|
79
|
+
assert_equal 'sample', file.filename
|
80
|
+
assert_equal @metadata, file.metadata
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
context "Writing arbitrary data fields" do
|
85
|
+
setup do
|
86
|
+
@data = "GRIDDATA" * 50000
|
87
|
+
@grid = Grid.new(@db, 'test-fs')
|
88
|
+
end
|
89
|
+
|
90
|
+
should "write random keys to the files collection" do
|
91
|
+
id = @grid.put(@data, :phrases => ["blimey", "ahoy!"])
|
92
|
+
file = @grid.get(id)
|
93
|
+
|
94
|
+
assert_equal ["blimey", "ahoy!"], file['phrases']
|
95
|
+
end
|
96
|
+
|
97
|
+
should "ignore special keys" do
|
98
|
+
id = @grid.put(@data, :file_length => 100, :phrase => "blimey")
|
99
|
+
file = @grid.get(id)
|
100
|
+
|
101
|
+
assert_equal "blimey", file['phrase']
|
102
|
+
assert_equal 400_000, file.file_length
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
49
106
|
context "Storing data with a length of zero" do
|
50
107
|
setup do
|
51
108
|
@grid = Grid.new(@db, 'test-fs')
|
@@ -74,7 +131,6 @@ class GridTest < Test::Unit::TestCase
|
|
74
131
|
read_data << chunk
|
75
132
|
end
|
76
133
|
assert_equal data.length, read_data.length
|
77
|
-
assert_equal data, read_data, "Unequal!"
|
78
134
|
end
|
79
135
|
|
80
136
|
@grid = Grid.new(@db, 'test-fs')
|
data/test/test_helper.rb
CHANGED
@@ -19,11 +19,14 @@ MSG
|
|
19
19
|
exit
|
20
20
|
end
|
21
21
|
|
22
|
-
require '
|
22
|
+
require 'bson_ext/cbson' if ENV['C_EXT']
|
23
|
+
|
24
|
+
MONGO_TEST_DB = 'mongo-ruby-test'
|
23
25
|
|
24
26
|
# NOTE: most tests assume that MongoDB is running.
|
25
27
|
class Test::Unit::TestCase
|
26
28
|
include Mongo
|
29
|
+
include BSON
|
27
30
|
|
28
31
|
# Generic code for rescuing connection failures and retrying operations.
|
29
32
|
# This could be combined with some timeout functionality.
|
@@ -6,7 +6,7 @@ class TestThreadingLargePool < Test::Unit::TestCase
|
|
6
6
|
|
7
7
|
include Mongo
|
8
8
|
|
9
|
-
@@db = Connection.new('localhost', 27017, :pool_size => 50, :timeout => 60).db(
|
9
|
+
@@db = Connection.new('localhost', 27017, :pool_size => 50, :timeout => 60).db(MONGO_TEST_DB)
|
10
10
|
@@coll = @@db.collection('thread-test-collection')
|
11
11
|
|
12
12
|
def set_up_safe_data
|
data/test/threading_test.rb
CHANGED
@@ -4,7 +4,7 @@ class TestThreading < Test::Unit::TestCase
|
|
4
4
|
|
5
5
|
include Mongo
|
6
6
|
|
7
|
-
@@db = Connection.new('localhost', 27017, :pool_size => 1, :timeout => 30).db(
|
7
|
+
@@db = Connection.new('localhost', 27017, :pool_size => 1, :timeout => 30).db(MONGO_TEST_DB)
|
8
8
|
@@coll = @@db.collection('thread-test-collection')
|
9
9
|
|
10
10
|
def set_up_safe_data
|
@@ -41,9 +41,9 @@ class CollectionTest < Test::Unit::TestCase
|
|
41
41
|
@conn = Connection.new('localhost', 27017, :logger => @logger, :connect => false)
|
42
42
|
@db = @conn['testing']
|
43
43
|
@coll = @db.collection('books')
|
44
|
-
data =
|
44
|
+
data = BSON::Binary.new(("BINARY " * 1000).unpack("c*"))
|
45
45
|
@conn.expects(:send_message).with do |op, msg, log|
|
46
|
-
op == 2002 && log.include?("
|
46
|
+
op == 2002 && log.include?("BSON::Binary")
|
47
47
|
end
|
48
48
|
@coll.insert({:data => data})
|
49
49
|
end
|
data/test/unit/cursor_test.rb
CHANGED
@@ -30,6 +30,13 @@ class CursorTest < Test::Unit::TestCase
|
|
30
30
|
assert @cursor.fields == {:name => 1, :date => 1}
|
31
31
|
end
|
32
32
|
|
33
|
+
should "set mix fields 0 and 1" do
|
34
|
+
assert_nil @cursor.fields
|
35
|
+
|
36
|
+
@cursor = Cursor.new(@collection, :fields => {:name => 1, :date => 0})
|
37
|
+
assert @cursor.fields == {:name => 1, :date => 0}
|
38
|
+
end
|
39
|
+
|
33
40
|
should "set limit" do
|
34
41
|
assert_equal 0, @cursor.limit
|
35
42
|
|
data/test/unit/db_test.rb
CHANGED
@@ -7,8 +7,8 @@ class DBTest < Test::Unit::TestCase
|
|
7
7
|
documents = [documents] unless documents.is_a?(Array)
|
8
8
|
message = ByteBuffer.new
|
9
9
|
message.put_int(0)
|
10
|
-
|
11
|
-
documents.each { |doc| message.put_array(
|
10
|
+
Mongo::BSON_CODER..serialize_cstr(message, "#{db.name}.test")
|
11
|
+
documents.each { |doc| message.put_array(Mongo::BSON_CODER.new.serialize(doc, true).to_a) }
|
12
12
|
message = db.add_message_headers(Mongo::Constants::OP_INSERT, message)
|
13
13
|
end
|
14
14
|
end
|
@@ -53,7 +53,7 @@ class DBTest < Test::Unit::TestCase
|
|
53
53
|
|
54
54
|
should "raise an error if logging out fails" do
|
55
55
|
@db.expects(:command).returns({})
|
56
|
-
assert_raise MongoDBError do
|
56
|
+
assert_raise Mongo::MongoDBError do
|
57
57
|
@db.logout
|
58
58
|
end
|
59
59
|
end
|
@@ -61,35 +61,35 @@ class DBTest < Test::Unit::TestCase
|
|
61
61
|
should "raise an error if collection creation fails" do
|
62
62
|
@db.expects(:collection_names).returns([])
|
63
63
|
@db.expects(:command).returns({})
|
64
|
-
assert_raise MongoDBError do
|
64
|
+
assert_raise Mongo::MongoDBError do
|
65
65
|
@db.create_collection("foo")
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
should "raise an error if getlasterror fails" do
|
70
70
|
@db.expects(:command).returns({})
|
71
|
-
assert_raise MongoDBError do
|
71
|
+
assert_raise Mongo::MongoDBError do
|
72
72
|
@db.error
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
should "raise an error if rename fails" do
|
77
77
|
@db.expects(:command).returns({})
|
78
|
-
assert_raise MongoDBError do
|
78
|
+
assert_raise Mongo::MongoDBError do
|
79
79
|
@db.rename_collection("foo", "bar")
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
83
|
should "raise an error if drop_index fails" do
|
84
84
|
@db.expects(:command).returns({})
|
85
|
-
assert_raise MongoDBError do
|
85
|
+
assert_raise Mongo::MongoDBError do
|
86
86
|
@db.drop_index("foo", "bar")
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
90
|
should "raise an error if set_profiling_level fails" do
|
91
91
|
@db.expects(:command).returns({})
|
92
|
-
assert_raise MongoDBError do
|
92
|
+
assert_raise Mongo::MongoDBError do
|
93
93
|
@db.profiling_level = :slow_only
|
94
94
|
end
|
95
95
|
end
|
metadata
CHANGED
@@ -1,12 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 19
|
8
|
-
- 3
|
9
|
-
version: 0.19.3
|
4
|
+
version: "0.20"
|
10
5
|
platform: ruby
|
11
6
|
authors:
|
12
7
|
- Jim Menard
|
@@ -16,7 +11,7 @@ autorequire:
|
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
13
|
|
19
|
-
date: 2010-04-
|
14
|
+
date: 2010-04-07 00:00:00 -04:00
|
20
15
|
default_executable:
|
21
16
|
dependencies: []
|
22
17
|
|
@@ -33,44 +28,19 @@ files:
|
|
33
28
|
- Rakefile
|
34
29
|
- mongo-ruby-driver.gemspec
|
35
30
|
- LICENSE.txt
|
36
|
-
- lib/
|
37
|
-
- lib/bson/bson_ruby.rb
|
38
|
-
- lib/bson/byte_buffer.rb
|
39
|
-
- lib/bson/exceptions.rb
|
40
|
-
- lib/bson/ordered_hash.rb
|
41
|
-
- lib/bson/types/binary.rb
|
42
|
-
- lib/bson/types/code.rb
|
43
|
-
- lib/bson/types/dbref.rb
|
44
|
-
- lib/bson/types/min_max_keys.rb
|
45
|
-
- lib/bson/types/objectid.rb
|
46
|
-
- lib/bson/types/regexp_of_holding.rb
|
47
|
-
- lib/bson.rb
|
31
|
+
- lib/mongo.rb
|
48
32
|
- lib/mongo/collection.rb
|
49
33
|
- lib/mongo/connection.rb
|
50
34
|
- lib/mongo/cursor.rb
|
51
35
|
- lib/mongo/db.rb
|
52
36
|
- lib/mongo/exceptions.rb
|
53
|
-
- lib/mongo/gridfs/chunk.rb
|
54
37
|
- lib/mongo/gridfs/grid.rb
|
55
38
|
- lib/mongo/gridfs/grid_file_system.rb
|
56
39
|
- lib/mongo/gridfs/grid_io.rb
|
57
|
-
- lib/mongo/gridfs/grid_store.rb
|
58
|
-
- lib/mongo/gridfs.rb
|
59
|
-
- lib/mongo/types/binary.rb
|
60
|
-
- lib/mongo/types/code.rb
|
61
|
-
- lib/mongo/types/dbref.rb
|
62
|
-
- lib/mongo/types/min_max_keys.rb
|
63
|
-
- lib/mongo/types/objectid.rb
|
64
|
-
- lib/mongo/types/regexp_of_holding.rb
|
65
|
-
- lib/mongo/util/bson_c.rb
|
66
|
-
- lib/mongo/util/bson_ruby.rb
|
67
|
-
- lib/mongo/util/byte_buffer.rb
|
68
40
|
- lib/mongo/util/conversions.rb
|
69
41
|
- lib/mongo/util/core_ext.rb
|
70
|
-
- lib/mongo/util/ordered_hash.rb
|
71
42
|
- lib/mongo/util/server_version.rb
|
72
43
|
- lib/mongo/util/support.rb
|
73
|
-
- lib/mongo.rb
|
74
44
|
- examples/admin.rb
|
75
45
|
- examples/capped.rb
|
76
46
|
- examples/cursor.rb
|
@@ -83,7 +53,6 @@ files:
|
|
83
53
|
- examples/types.rb
|
84
54
|
- bin/bson_benchmark.rb
|
85
55
|
- bin/fail_if_no_c.rb
|
86
|
-
- bin/gr.rb
|
87
56
|
has_rdoc: true
|
88
57
|
homepage: http://www.mongodb.org
|
89
58
|
licenses: []
|
@@ -99,20 +68,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
68
|
requirements:
|
100
69
|
- - ">="
|
101
70
|
- !ruby/object:Gem::Version
|
102
|
-
segments:
|
103
|
-
- 0
|
104
71
|
version: "0"
|
72
|
+
version:
|
105
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
74
|
requirements:
|
107
75
|
- - ">="
|
108
76
|
- !ruby/object:Gem::Version
|
109
|
-
segments:
|
110
|
-
- 0
|
111
77
|
version: "0"
|
78
|
+
version:
|
112
79
|
requirements: []
|
113
80
|
|
114
81
|
rubyforge_project:
|
115
|
-
rubygems_version: 1.3.
|
82
|
+
rubygems_version: 1.3.5
|
116
83
|
signing_key:
|
117
84
|
specification_version: 3
|
118
85
|
summary: Ruby driver for the MongoDB
|
@@ -120,10 +87,6 @@ test_files:
|
|
120
87
|
- test/auxillary/1.4_features.rb
|
121
88
|
- test/auxillary/authentication_test.rb
|
122
89
|
- test/auxillary/autoreconnect_test.rb
|
123
|
-
- test/binary_test.rb
|
124
|
-
- test/bson_test.rb
|
125
|
-
- test/byte_buffer_test.rb
|
126
|
-
- test/chunk_test.rb
|
127
90
|
- test/collection_test.rb
|
128
91
|
- test/connection_test.rb
|
129
92
|
- test/conversions_test.rb
|
@@ -133,10 +96,7 @@ test_files:
|
|
133
96
|
- test/db_test.rb
|
134
97
|
- test/grid_file_system_test.rb
|
135
98
|
- test/grid_io_test.rb
|
136
|
-
- test/grid_store_test.rb
|
137
99
|
- test/grid_test.rb
|
138
|
-
- test/objectid_test.rb
|
139
|
-
- test/ordered_hash_test.rb
|
140
100
|
- test/replica/count_test.rb
|
141
101
|
- test/replica/insert_test.rb
|
142
102
|
- test/replica/pooled_insert_test.rb
|