mongodb-mongo 0.12 → 0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/README.rdoc +12 -12
  2. data/Rakefile +1 -1
  3. data/bin/bson_benchmark.rb +1 -1
  4. data/bin/mongo_console +3 -3
  5. data/bin/run_test_script +2 -2
  6. data/bin/standard_benchmark +3 -3
  7. data/examples/admin.rb +3 -3
  8. data/examples/benchmarks.rb +2 -2
  9. data/examples/blog.rb +4 -4
  10. data/examples/capped.rb +3 -3
  11. data/examples/cursor.rb +3 -3
  12. data/examples/gridfs.rb +4 -4
  13. data/examples/index_test.rb +11 -11
  14. data/examples/info.rb +3 -3
  15. data/examples/queries.rb +3 -3
  16. data/examples/simple.rb +3 -3
  17. data/examples/strict.rb +3 -3
  18. data/examples/types.rb +4 -9
  19. data/lib/mongo.rb +35 -3
  20. data/lib/mongo/admin.rb +56 -60
  21. data/lib/mongo/collection.rb +368 -320
  22. data/lib/mongo/connection.rb +166 -0
  23. data/lib/mongo/cursor.rb +206 -209
  24. data/lib/mongo/db.rb +478 -489
  25. data/lib/mongo/errors.rb +8 -9
  26. data/lib/mongo/gridfs/chunk.rb +66 -70
  27. data/lib/mongo/gridfs/grid_store.rb +406 -410
  28. data/lib/mongo/message/get_more_message.rb +8 -13
  29. data/lib/mongo/message/insert_message.rb +7 -11
  30. data/lib/mongo/message/kill_cursors_message.rb +7 -12
  31. data/lib/mongo/message/message.rb +58 -62
  32. data/lib/mongo/message/message_header.rb +19 -24
  33. data/lib/mongo/message/msg_message.rb +5 -9
  34. data/lib/mongo/message/opcodes.rb +10 -15
  35. data/lib/mongo/message/query_message.rb +42 -46
  36. data/lib/mongo/message/remove_message.rb +8 -12
  37. data/lib/mongo/message/update_message.rb +9 -13
  38. data/lib/mongo/query.rb +84 -88
  39. data/lib/mongo/types/binary.rb +13 -17
  40. data/lib/mongo/types/code.rb +9 -13
  41. data/lib/mongo/types/dbref.rb +10 -14
  42. data/lib/mongo/types/objectid.rb +103 -107
  43. data/lib/mongo/types/regexp_of_holding.rb +18 -22
  44. data/lib/mongo/types/undefined.rb +7 -10
  45. data/lib/mongo/util/bson.rb +4 -9
  46. data/lib/mongo/util/xml_to_ruby.rb +1 -3
  47. data/mongo-ruby-driver.gemspec +33 -32
  48. data/{tests → test}/mongo-qa/_common.rb +1 -1
  49. data/{tests → test}/mongo-qa/admin +1 -1
  50. data/{tests → test}/mongo-qa/capped +1 -1
  51. data/{tests → test}/mongo-qa/count1 +4 -4
  52. data/{tests → test}/mongo-qa/dbs +1 -1
  53. data/{tests → test}/mongo-qa/find +1 -1
  54. data/{tests → test}/mongo-qa/find1 +1 -1
  55. data/{tests → test}/mongo-qa/gridfs_in +2 -2
  56. data/{tests → test}/mongo-qa/gridfs_out +2 -2
  57. data/{tests → test}/mongo-qa/indices +2 -2
  58. data/{tests → test}/mongo-qa/remove +1 -1
  59. data/{tests → test}/mongo-qa/stress1 +1 -1
  60. data/{tests → test}/mongo-qa/test1 +1 -1
  61. data/{tests → test}/mongo-qa/update +1 -1
  62. data/{tests → test}/test_admin.rb +3 -3
  63. data/{tests → test}/test_bson.rb +4 -4
  64. data/{tests → test}/test_byte_buffer.rb +0 -0
  65. data/{tests → test}/test_chunk.rb +4 -4
  66. data/{tests → test}/test_collection.rb +42 -4
  67. data/{tests/test_mongo.rb → test/test_connection.rb} +35 -11
  68. data/test/test_cursor.rb +223 -0
  69. data/{tests → test}/test_db.rb +12 -12
  70. data/{tests → test}/test_db_api.rb +28 -33
  71. data/{tests → test}/test_db_connection.rb +3 -3
  72. data/{tests → test}/test_grid_store.rb +4 -4
  73. data/{tests → test}/test_message.rb +1 -1
  74. data/{tests → test}/test_objectid.rb +3 -3
  75. data/{tests → test}/test_ordered_hash.rb +0 -0
  76. data/{tests → test}/test_round_trip.rb +6 -2
  77. data/{tests → test}/test_threading.rb +3 -3
  78. data/test/test_xgen.rb +73 -0
  79. metadata +33 -32
  80. data/lib/mongo/mongo.rb +0 -164
  81. data/tests/test_cursor.rb +0 -121
@@ -14,31 +14,27 @@
14
14
  # limitations under the License.
15
15
  # ++
16
16
 
17
- module XGen
18
- module Mongo
19
- module Driver
17
+ module Mongo
20
18
 
21
- # A Regexp that can hold on to extra options and ignore them. Mongo
22
- # regexes may contain option characters beyond 'i', 'm', and 'x'. (Note
23
- # that Mongo only uses those three, but that regexes coming from other
24
- # languages may store different option characters.)
25
- #
26
- # Note that you do not have to use this class at all if you wish to
27
- # store regular expressions in Mongo. The Mongo and Ruby regex option
28
- # flags are the same. Storing regexes is discouraged, in any case.
29
- class RegexpOfHolding < Regexp
19
+ # A Regexp that can hold on to extra options and ignore them. Mongo
20
+ # regexes may contain option characters beyond 'i', 'm', and 'x'. (Note
21
+ # that Mongo only uses those three, but that regexes coming from other
22
+ # languages may store different option characters.)
23
+ #
24
+ # Note that you do not have to use this class at all if you wish to
25
+ # store regular expressions in Mongo. The Mongo and Ruby regex option
26
+ # flags are the same. Storing regexes is discouraged, in any case.
27
+ class RegexpOfHolding < Regexp
30
28
 
31
- attr_accessor :extra_options_str
32
-
33
- # +str+ and +options+ are the same as Regexp. +extra_options_str+
34
- # contains all the other flags that were in Mongo but we do not use or
35
- # understand.
36
- def initialize(str, options, extra_options_str)
37
- super(str, options)
38
- @extra_options_str = extra_options_str
39
- end
40
- end
29
+ attr_accessor :extra_options_str
41
30
 
31
+ # +str+ and +options+ are the same as Regexp. +extra_options_str+
32
+ # contains all the other flags that were in Mongo but we do not use or
33
+ # understand.
34
+ def initialize(str, options, extra_options_str)
35
+ super(str, options)
36
+ @extra_options_str = extra_options_str
42
37
  end
43
38
  end
39
+
44
40
  end
@@ -14,18 +14,15 @@
14
14
  # limitations under the License.
15
15
  # ++
16
16
 
17
- module XGen
18
- module Mongo
19
- module Driver
17
+ module Mongo
20
18
 
21
- # A special "undefined" type to match Mongo's storage of UNKNOWN values.
22
- # "UNKNOWN" comes from JavaScript.
23
- #
24
- # NOTE: this class does not attempt to provide ANY of the semantics an
25
- # "unknown" object might need. It isn't nil, it isn't special in any
26
- # way, and there isn't any singleton value.
27
- class Undefined < Object; end
19
+ # DEPRECATED - the ruby driver converts the BSON undefined type to nil,
20
+ # and saves this type as nil
21
+ class Undefined < Object
28
22
 
23
+ def initialize
24
+ super
25
+ warn "the Undefined type is deprecated and will be removed - BSON undefineds get implicitly converted to nil now"
29
26
  end
30
27
  end
31
28
  end
@@ -26,7 +26,7 @@ require 'mongo/types/undefined'
26
26
  # A BSON seralizer/deserializer.
27
27
  class BSON
28
28
 
29
- include XGen::Mongo::Driver
29
+ include Mongo
30
30
 
31
31
  MINKEY = -1
32
32
  EOO = 0
@@ -135,7 +135,7 @@ class BSON
135
135
  when BINARY
136
136
  serialize_binary_element(@buf, k, v)
137
137
  when UNDEFINED
138
- serialize_undefined_element(@buf, k)
138
+ serialize_null_element(@buf, k)
139
139
  when CODE_W_SCOPE
140
140
  serialize_code_w_scope(@buf, k, v)
141
141
  else
@@ -207,7 +207,7 @@ class BSON
207
207
  doc[key] = nil
208
208
  when UNDEFINED
209
209
  key = deserialize_cstr(@buf)
210
- doc[key] = Undefined.new
210
+ doc[key] = nil
211
211
  when REF
212
212
  key = deserialize_cstr(@buf)
213
213
  doc[key] = deserialize_dbref_data(@buf)
@@ -385,11 +385,6 @@ class BSON
385
385
  end
386
386
  end
387
387
 
388
- def serialize_undefined_element(buf, key)
389
- buf.put(UNDEFINED)
390
- self.class.serialize_cstr(buf, key)
391
- end
392
-
393
388
  def serialize_boolean_element(buf, key, val)
394
389
  buf.put(BOOLEAN)
395
390
  self.class.serialize_cstr(buf, key)
@@ -543,7 +538,7 @@ class BSON
543
538
  when Symbol
544
539
  SYMBOL
545
540
  when Undefined
546
- UNDEFINED
541
+ NULL
547
542
  else
548
543
  raise "Unknown type of object: #{o.class.name}"
549
544
  end
@@ -21,7 +21,7 @@ require 'mongo'
21
21
  # an OrderedHash.
22
22
  class XMLToRuby
23
23
 
24
- include XGen::Mongo::Driver
24
+ include Mongo
25
25
 
26
26
  def xml_to_ruby(io)
27
27
  doc = REXML::Document.new(io)
@@ -63,8 +63,6 @@ class XMLToRuby
63
63
  regex_to_ruby(e.elements)
64
64
  when 'null'
65
65
  nil
66
- when 'undefined'
67
- Undefined.new
68
66
  when 'doc'
69
67
  doc_to_ruby(e)
70
68
  else
@@ -19,6 +19,7 @@ PACKAGE_FILES = ['README.rdoc', 'Rakefile', 'mongo-ruby-driver.gemspec',
19
19
  'examples/types.rb',
20
20
  'lib/mongo/admin.rb',
21
21
  'lib/mongo/collection.rb',
22
+ 'lib/mongo/connection.rb',
22
23
  'lib/mongo/cursor.rb',
23
24
  'lib/mongo/db.rb',
24
25
  'lib/mongo/gridfs/chunk.rb',
@@ -36,7 +37,6 @@ PACKAGE_FILES = ['README.rdoc', 'Rakefile', 'mongo-ruby-driver.gemspec',
36
37
  'lib/mongo/message/remove_message.rb',
37
38
  'lib/mongo/message/update_message.rb',
38
39
  'lib/mongo/message.rb',
39
- 'lib/mongo/mongo.rb',
40
40
  'lib/mongo/query.rb',
41
41
  'lib/mongo/types/binary.rb',
42
42
  'lib/mongo/types/code.rb',
@@ -49,40 +49,41 @@ PACKAGE_FILES = ['README.rdoc', 'Rakefile', 'mongo-ruby-driver.gemspec',
49
49
  'lib/mongo/util/ordered_hash.rb',
50
50
  'lib/mongo/util/xml_to_ruby.rb',
51
51
  'lib/mongo.rb']
52
- TEST_FILES = ['tests/mongo-qa/_common.rb',
53
- 'tests/mongo-qa/admin',
54
- 'tests/mongo-qa/capped',
55
- 'tests/mongo-qa/count1',
56
- 'tests/mongo-qa/dbs',
57
- 'tests/mongo-qa/find',
58
- 'tests/mongo-qa/find1',
59
- 'tests/mongo-qa/gridfs_in',
60
- 'tests/mongo-qa/gridfs_out',
61
- 'tests/mongo-qa/indices',
62
- 'tests/mongo-qa/remove',
63
- 'tests/mongo-qa/stress1',
64
- 'tests/mongo-qa/test1',
65
- 'tests/mongo-qa/update',
66
- 'tests/test_admin.rb',
67
- 'tests/test_bson.rb',
68
- 'tests/test_byte_buffer.rb',
69
- 'tests/test_chunk.rb',
70
- 'tests/test_collection.rb',
71
- 'tests/test_cursor.rb',
72
- 'tests/test_db.rb',
73
- 'tests/test_db_api.rb',
74
- 'tests/test_db_connection.rb',
75
- 'tests/test_grid_store.rb',
76
- 'tests/test_message.rb',
77
- 'tests/test_mongo.rb',
78
- 'tests/test_objectid.rb',
79
- 'tests/test_ordered_hash.rb',
80
- 'tests/test_threading.rb',
81
- 'tests/test_round_trip.rb']
52
+ TEST_FILES = ['test/mongo-qa/_common.rb',
53
+ 'test/mongo-qa/admin',
54
+ 'test/mongo-qa/capped',
55
+ 'test/mongo-qa/count1',
56
+ 'test/mongo-qa/dbs',
57
+ 'test/mongo-qa/find',
58
+ 'test/mongo-qa/find1',
59
+ 'test/mongo-qa/gridfs_in',
60
+ 'test/mongo-qa/gridfs_out',
61
+ 'test/mongo-qa/indices',
62
+ 'test/mongo-qa/remove',
63
+ 'test/mongo-qa/stress1',
64
+ 'test/mongo-qa/test1',
65
+ 'test/mongo-qa/update',
66
+ 'test/test_admin.rb',
67
+ 'test/test_bson.rb',
68
+ 'test/test_byte_buffer.rb',
69
+ 'test/test_chunk.rb',
70
+ 'test/test_collection.rb',
71
+ 'test/test_connection.rb',
72
+ 'test/test_cursor.rb',
73
+ 'test/test_db.rb',
74
+ 'test/test_db_api.rb',
75
+ 'test/test_db_connection.rb',
76
+ 'test/test_grid_store.rb',
77
+ 'test/test_message.rb',
78
+ 'test/test_objectid.rb',
79
+ 'test/test_ordered_hash.rb',
80
+ 'test/test_threading.rb',
81
+ 'test/test_round_trip.rb',
82
+ 'test/test_xgen.rb']
82
83
 
83
84
  Gem::Specification.new do |s|
84
85
  s.name = 'mongo'
85
- s.version = '0.12'
86
+ s.version = '0.13'
86
87
  s.platform = Gem::Platform::RUBY
87
88
  s.summary = 'Ruby driver for the 10gen Mongo DB'
88
89
  s.description = 'A Ruby driver for the 10gen Mongo DB. For more information about Mongo, see http://www.mongodb.org.'
@@ -5,4 +5,4 @@ DEFAULT_HOST = '127.0.0.1'
5
5
  DEFAULT_PORT = 27017
6
6
  DEFAULT_DB = 'driver_test_framework'
7
7
 
8
- include XGen::Mongo::Driver
8
+ include Mongo
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require File.join(File.dirname(__FILE__), '_common.rb')
4
- db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
4
+ db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
5
5
 
6
6
  db.collection('test').insert({'test' => 1})
7
7
  admin = db.admin
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require File.join(File.dirname(__FILE__), '_common.rb')
4
- db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
4
+ db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
5
5
 
6
6
  if $DEBUG
7
7
  db.drop_collection('capped1')
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require File.join(File.dirname(__FILE__), '_common.rb')
4
- db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
4
+ db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
5
5
 
6
6
  if $DEBUG
7
7
  3.times { |i| db.drop_collection("test#{i+1}") }
@@ -13,6 +13,6 @@ end
13
13
 
14
14
  puts db.collection('test1').count
15
15
  puts db.collection('test2').count
16
- puts db.collection('test3').count('i' => 'a')
17
- puts db.collection('test3').count('i' => 3)
18
- puts db.collection('test3').count({'i' => {'$gte' => 67}})
16
+ puts db.collection('test3').find('i' => 'a').count
17
+ puts db.collection('test3').find('i' => 3).count
18
+ puts db.collection('test3').find({'i' => {'$gte' => 67}}).count
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require File.join(File.dirname(__FILE__), '_common.rb')
4
- db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
4
+ db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
5
5
 
6
6
  if $DEBUG
7
7
  3.times { |i| db.drop_collection("dbs_#{i+1}") }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require File.join(File.dirname(__FILE__), '_common.rb')
4
- db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
4
+ db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
5
5
 
6
6
  if $DEBUG
7
7
  db.drop_collection('test')
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require File.join(File.dirname(__FILE__), '_common.rb')
4
- db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
4
+ db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
5
5
 
6
6
  if $DEBUG
7
7
  db.drop_collection('c')
@@ -3,9 +3,9 @@
3
3
  require File.join(File.dirname(__FILE__), '_common.rb')
4
4
 
5
5
  require 'mongo/gridfs'
6
- include XGen::Mongo::GridFS
6
+ include GridFS
7
7
 
8
- db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
8
+ db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
9
9
 
10
10
  input_file = ARGV[0]
11
11
 
@@ -3,9 +3,9 @@
3
3
  require File.join(File.dirname(__FILE__), '_common.rb')
4
4
 
5
5
  require 'mongo/gridfs'
6
- include XGen::Mongo::GridFS
6
+ include GridFS
7
7
 
8
- db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
8
+ db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
9
9
 
10
10
  input_file = ARGV[0]
11
11
  output_file = ARGV[1]
@@ -2,9 +2,9 @@
2
2
 
3
3
  require File.join(File.dirname(__FILE__), '_common.rb')
4
4
 
5
- include XGen::Mongo
5
+ include Mongo
6
6
 
7
- db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
7
+ db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
8
8
  x = db.collection('x')
9
9
  y = db.collection('y')
10
10
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require File.join(File.dirname(__FILE__), '_common.rb')
4
- db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
4
+ db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
5
5
 
6
6
  if $DEBUG
7
7
  c = db.collection('remove1')
@@ -3,7 +3,7 @@
3
3
  LONG_STRING = "lksjhasoh1298alshasoidiohaskjasiouashoasasiugoas" * 6
4
4
 
5
5
  require File.join(File.dirname(__FILE__), '_common.rb')
6
- db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
6
+ db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
7
7
  c = db.collection('stress1')
8
8
 
9
9
  n1 = 50_000
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require File.join(File.dirname(__FILE__), '_common.rb')
4
- db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
4
+ db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
5
5
  coll = db.collection('part1')
6
6
 
7
7
  if $DEBUG
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require File.join(File.dirname(__FILE__), '_common.rb')
4
- db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
4
+ db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
5
5
  foo = db.collection('foo')
6
6
 
7
7
  if $DEBUG
@@ -5,10 +5,10 @@ require 'test/unit'
5
5
  # NOTE: assumes Mongo is running
6
6
  class AdminTest < Test::Unit::TestCase
7
7
 
8
- include XGen::Mongo::Driver
8
+ include Mongo
9
9
 
10
- @@db = Mongo.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
11
- ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::DEFAULT_PORT).db('ruby-mongo-test')
10
+ @@db = Connection.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
11
+ ENV['MONGO_RUBY_DRIVER_PORT'] || Connection::DEFAULT_PORT).db('ruby-mongo-test')
12
12
  @@coll = @@db.collection('test')
13
13
 
14
14
  def setup
@@ -5,7 +5,7 @@ require 'test/unit'
5
5
 
6
6
  class BSONTest < Test::Unit::TestCase
7
7
 
8
- include XGen::Mongo::Driver
8
+ include Mongo
9
9
 
10
10
  def setup
11
11
  # We don't pass a DB to the constructor, even though we are about to test
@@ -85,7 +85,7 @@ class BSONTest < Test::Unit::TestCase
85
85
  assert_equal doc, doc2
86
86
 
87
87
  r = doc2['doc']
88
- assert_kind_of XGen::Mongo::Driver::RegexpOfHolding, r
88
+ assert_kind_of RegexpOfHolding, r
89
89
  assert_equal '', r.extra_options_str
90
90
 
91
91
  r.extra_options_str << 'zywcab'
@@ -99,7 +99,7 @@ class BSONTest < Test::Unit::TestCase
99
99
  assert_equal doc, doc2
100
100
 
101
101
  r = doc2['doc']
102
- assert_kind_of XGen::Mongo::Driver::RegexpOfHolding, r
102
+ assert_kind_of RegexpOfHolding, r
103
103
  assert_equal 'abcwyz', r.extra_options_str # must be sorted
104
104
  end
105
105
 
@@ -183,7 +183,7 @@ class BSONTest < Test::Unit::TestCase
183
183
  doc = {'undef' => Undefined.new}
184
184
  @b.serialize(doc)
185
185
  doc2 = @b.deserialize
186
- assert_kind_of Undefined, doc2['undef']
186
+ assert_equal nil, doc2['undef']
187
187
  end
188
188
 
189
189
  def test_put_id_first
File without changes
@@ -5,11 +5,11 @@ require 'mongo/gridfs'
5
5
 
6
6
  class ChunkTest < Test::Unit::TestCase
7
7
 
8
- include XGen::Mongo::Driver
9
- include XGen::Mongo::GridFS
8
+ include Mongo
9
+ include GridFS
10
10
 
11
- @@db = Mongo.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
12
- ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::DEFAULT_PORT).db('ruby-mongo-utils-test')
11
+ @@db = Connection.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
12
+ ENV['MONGO_RUBY_DRIVER_PORT'] || Connection::DEFAULT_PORT).db('ruby-mongo-utils-test')
13
13
  @@files = @@db.collection('gridfs.files')
14
14
  @@chunks = @@db.collection('gridfs.chunks')
15
15