deprecated Cursor#next_object for Cursor#next_document

This commit is contained in:
Kyle Banker 2009-12-16 18:09:48 -05:00
parent 8df3e595fb
commit 7655a2c424
2 changed files with 12 additions and 0 deletions

View File

@ -71,6 +71,11 @@ module Mongo
doc doc
end end
def next_object
warn "Cursor#next_object is deprecated; please use Cursor#next_document instead."
next_document
end
# Get the size of the result set for this query. # Get the size of the result set for this query.
# #
# Returns the number of objects in the result set for this query. Does # Returns the number of objects in the result set for this query. Does

View File

@ -58,6 +58,13 @@ class CursorTest < Test::Unit::TestCase
assert_equal 0, @@db['acollectionthatdoesn'].count() assert_equal 0, @@db['acollectionthatdoesn'].count()
end end
def test_next_object_deprecation
@@coll.remove
@@coll.insert({"a" => 1})
assert_equal 1, @@coll.find().next_object["a"]
end
def test_sort def test_sort
@@coll.remove @@coll.remove
5.times{|x| @@coll.insert({"a" => x}) } 5.times{|x| @@coll.insert({"a" => x}) }