diff --git a/lib/mongo/util/bson.rb b/lib/mongo/util/bson.rb index 07d2bed..2b3ba93 100644 --- a/lib/mongo/util/bson.rb +++ b/lib/mongo/util/bson.rb @@ -213,7 +213,7 @@ class BSON end_pos = buf.position # Put the string size in front - buf.put_int(end_pos - start_pos - 1, len_pos) + buf.put_int(end_pos - start_pos, len_pos) # Go back to where we were buf.position = end_pos diff --git a/tests/test_db_api.rb b/tests/test_db_api.rb index 4e75118..e2b4f08 100644 --- a/tests/test_db_api.rb +++ b/tests/test_db_api.rb @@ -72,9 +72,7 @@ class DBAPITest < Test::Unit::TestCase assert rows.length >= 1 row = rows.detect { |r| r['name'] == @coll_full_name } assert_not_nil row -# FIXME restore this test when Mongo fixes this bug (or we prove I'm doing something wrong) - # Mongo bug: returns string with wrong length, so last byte of value is chopped off. -# assert_equal @coll.name, row['options']['create'] + assert_equal @coll.name, row['options']['create'] end def test_full_coll_name