Skip to content

Commit 2b70111

Browse files
author
Mike Dirolf
committed
complete deprecation of a bunch of stuff
1 parent f41b48a commit 2b70111

File tree

12 files changed

+2
-274
lines changed

12 files changed

+2
-274
lines changed

ext/cbson/cbson.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,6 @@ static int write_element_allow_id(VALUE key, VALUE value, VALUE extra, int allow
371371
memcpy(buffer->buffer + length_location, &obj_length, 4);
372372
break;
373373
}
374-
if (strcmp(cls, "Mongo::Undefined") == 0) {
375-
write_name_and_type(buffer, key, 0x0A); // just use nil type
376-
break;
377-
}
378374
}
379375
case T_DATA:
380376
{

lib/mongo.rb

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
require 'mongo/types/dbref'
33
require 'mongo/types/objectid'
44
require 'mongo/types/regexp_of_holding'
5-
require 'mongo/types/undefined'
65

76
require 'mongo/errors'
87
require 'mongo/connection'
@@ -18,37 +17,3 @@ module Mongo
1817

1918
VERSION = "0.14.1"
2019
end
21-
22-
# DEPRECATED - the XGen namespace is deprecated and will be removed - use Mongo or GridFS instead
23-
MongoCopy = Mongo
24-
module XGen
25-
require 'mongo/gridfs'
26-
GridFSCopy = GridFS
27-
28-
def self.included(other_module)
29-
warn "the XGen module is deprecated and will be removed - use Mongo or GridFS instead (included from: #{other_module})"
30-
end
31-
32-
module Mongo
33-
include MongoCopy
34-
35-
def self.included(other_module)
36-
warn "the XGen::Mongo module is deprecated and will be removed - use Mongo instead (included from: #{other_module})"
37-
end
38-
39-
module Driver
40-
include MongoCopy
41-
42-
def self.included(other_module)
43-
warn "the XGen::Mongo::Driver module is deprecated and will be removed - use Mongo instead (included from: #{other_module})"
44-
end
45-
end
46-
module GridFS
47-
include GridFSCopy
48-
49-
def self.included(other_module)
50-
warn "the XGen::Mongo::GridFS module is deprecated and will be removed - use GridFS instead (included from: #{other_module})"
51-
end
52-
end
53-
end
54-
end

lib/mongo/collection.rb

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,6 @@ def find_one(spec_or_object_id=nil, options={})
148148
find(spec, options.merge(:limit => -1)).next_object
149149
end
150150

151-
# DEPRECATED - use find_one instead
152-
#
153-
# Find the first record that matches +selector+. See #find.
154-
def find_first(selector={}, options={})
155-
warn "Collection#find_first is deprecated and will be removed. Please use Collection#find_one instead."
156-
find_one(selector, options)
157-
end
158-
159151
# Save a document in this collection.
160152
#
161153
# If +to_save+ already has an '_id' then an update (upsert) operation
@@ -214,32 +206,6 @@ def clear
214206
remove({})
215207
end
216208

217-
# DEPRECATED - use update(... :upsert => true) instead
218-
#
219-
# Update records that match +selector+ by applying +obj+ as an update.
220-
# If no match, inserts (???).
221-
def repsert(selector, obj)
222-
warn "Collection#repsert is deprecated and will be removed. Please use Collection#update instead."
223-
update(selector, obj, :upsert => true)
224-
end
225-
226-
# DEPRECATED - use update(... :upsert => false) instead
227-
#
228-
# Update records that match +selector+ by applying +obj+ as an update.
229-
def replace(selector, obj)
230-
warn "Collection#replace is deprecated and will be removed. Please use Collection#update instead."
231-
update(selector, obj)
232-
end
233-
234-
# DEPRECATED - use update(... :upsert => false) instead
235-
#
236-
# Update records that match +selector+ by applying +obj+ as an update.
237-
# Both +selector+ and +modifier_obj+ are required.
238-
def modify(selector, modifier_obj)
239-
warn "Collection#modify is deprecated and will be removed. Please use Collection#update instead."
240-
update(selector, modifier_obj)
241-
end
242-
243209
# Update a single document in this collection.
244210
#
245211
# :spec :: a hash specifying elements which must be present for
@@ -420,14 +386,8 @@ def options
420386
end
421387

422388
# Get the number of documents in this collection.
423-
#
424-
# Specifying a +selector+ is DEPRECATED and will be removed. Please use
425-
# find(selector).count() instead.
426-
def count(selector=nil)
427-
if selector
428-
warn "specifying a selector for Collection#count is deprecated and will be removed. Please use Collection.find(selector).count instead."
429-
end
430-
find(selector || {}).count()
389+
def count()
390+
find().count()
431391
end
432392

433393
protected

lib/mongo/connection.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,4 @@ def single_db_command(db_name, cmd)
148148
end
149149
end
150150
end
151-
152-
class Mongo < Connection
153-
def initialize(pair_or_host=nil, port=nil, options={})
154-
super(pair_or_host, port, options)
155-
156-
warn "Mongo::Mongo is deprecated and will be removed - please use Mongo::Connection"
157-
end
158-
end
159151
end

lib/mongo/db.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,6 @@ def replace_in_db(collection_name, selector, obj)
388388
}
389389
end
390390

391-
# DEPRECATED - use Collection#update instead
392-
def modify_in_db(collection_name, selector, obj)
393-
warn "DB#modify_in_db is deprecated and will be removed. Please use Collection#update instead."
394-
replace_in_db(collection_name, selector, obj)
395-
end
396-
397391
# Update records in +collection_name+ that match +selector+ by
398392
# applying +obj+ as an update. If no match, inserts (???). Normally
399393
# called by Collection#repsert.
@@ -405,12 +399,6 @@ def repsert_in_db(collection_name, selector, obj)
405399
}
406400
end
407401

408-
# DEPRECATED - use Collection.find(selector).count() instead
409-
def count(collection_name, selector={})
410-
warn "DB#count is deprecated and will be removed. Please use Collection.find(selector).count instead."
411-
collection(collection_name).find(selector).count()
412-
end
413-
414402
# Dereference a DBRef, getting the document it points to.
415403
def dereference(dbref)
416404
collection(dbref.namespace).find_one("_id" => dbref.object_id)

lib/mongo/types/undefined.rb

Lines changed: 0 additions & 28 deletions
This file was deleted.

lib/mongo/util/bson.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
require 'mongo/types/dbref'
2222
require 'mongo/types/objectid'
2323
require 'mongo/types/regexp_of_holding'
24-
require 'mongo/types/undefined'
2524

2625
# A BSON seralizer/deserializer.
2726
class BSON
@@ -539,8 +538,6 @@ def bson_type(o)
539538
OBJECT
540539
when Symbol
541540
SYMBOL
542-
when Undefined
543-
NULL
544541
else
545542
raise "Unknown type of object: #{o.class.name}"
546543
end

test/test_bson.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,6 @@ def test_binary_byte_buffer
194194
assert_equal Binary::SUBTYPE_BYTES, bin2.subtype
195195
end
196196

197-
def test_undefined
198-
doc = {'undef' => Undefined.new}
199-
@b.serialize(doc)
200-
doc2 = @b.deserialize
201-
assert_equal nil, doc2['undef']
202-
end
203-
204197
def test_put_id_first
205198
val = OrderedHash.new
206199
val['not_id'] = 1

test/test_collection.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ def test_count
110110
@@test.save("x" => 1)
111111
@@test.save("x" => 2)
112112
assert_equal 2, @@test.count
113-
114-
# TODO remove this test - it's deprecated
115-
assert_equal 1, @@test.count("x" => 1)
116113
end
117114

118115
def test_find_one

test/test_connection.rb

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -99,28 +99,3 @@ def test_pair
9999
assert_equal ['foo', 123], pair[1]
100100
end
101101
end
102-
103-
# Test for deprecated Mongo class
104-
class TestMongo < Test::Unit::TestCase
105-
106-
include Mongo
107-
108-
def setup
109-
@host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
110-
@port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::DEFAULT_PORT
111-
@mongo = Mongo.new(@host, @port)
112-
end
113-
114-
def test_database_info
115-
@mongo.drop_database('ruby-mongo-info-test')
116-
@mongo.db('ruby-mongo-info-test').collection('info-test').insert('a' => 1)
117-
118-
info = @mongo.database_info
119-
assert_not_nil info
120-
assert_kind_of Hash, info
121-
assert_not_nil info['ruby-mongo-info-test']
122-
assert info['ruby-mongo-info-test'] > 0
123-
124-
@mongo.drop_database('ruby-mongo-info-test')
125-
end
126-
end

0 commit comments

Comments
 (0)