diff --git a/mongo-ruby-driver.gemspec b/mongo-ruby-driver.gemspec index 4e6a479..ea61735 100644 --- a/mongo-ruby-driver.gemspec +++ b/mongo-ruby-driver.gemspec @@ -35,6 +35,7 @@ PACKAGE_FILES = ['README.rdoc', 'Rakefile', 'mongo-ruby-driver.gemspec', 'lib/mongo/mongo.rb', 'lib/mongo/query.rb', 'lib/mongo/types/binary.rb', + 'lib/mongo/types/code.rb', 'lib/mongo/types/dbref.rb', 'lib/mongo/types/objectid.rb', 'lib/mongo/types/regexp_of_holding.rb', diff --git a/tests/test_db_api.rb b/tests/test_db_api.rb index 40ff134..c0a5a0d 100644 --- a/tests/test_db_api.rb +++ b/tests/test_db_api.rb @@ -442,6 +442,15 @@ class DBAPITest < Test::Unit::TestCase assert_equal "#{@@db.host}:#{@@db.port}", @@db.master end + def test_where + @@coll.insert('a' => 2) + @@coll.insert('a' => 3) + + assert_equal 3, @@coll.count + assert_equal 1, @@coll.find('$where' => Code.new('this.a > 2')).count + assert_equal 2, @@coll.find('$where' => Code.new('this.a > i', {'i' => 1})).count + end + def test_hint name = @@coll.create_index('a') begin