Fixed DBRef BSON format.

This commit is contained in:
Jim Menard 2009-01-15 15:12:16 -05:00
parent e1e8452efa
commit 59f32caf57
2 changed files with 3 additions and 5 deletions

View File

@ -7,7 +7,7 @@ require 'rake/gempackagetask'
require 'rake/contrib/rubyforgepublisher' require 'rake/contrib/rubyforgepublisher'
GEM = "mongo" GEM = "mongo"
GEM_VERSION = '0.1.1' GEM_VERSION = '0.1.2'
SUMMARY = 'Simple pure-Ruby driver for the 10gen Mongo DB' SUMMARY = 'Simple pure-Ruby driver for the 10gen Mongo DB'
DESCRIPTION = 'This is a simple pure-Ruby driver for the 10gen Mongo DB. For more information about Mongo, see http://www.mongodb.org.' DESCRIPTION = 'This is a simple pure-Ruby driver for the 10gen Mongo DB. For more information about Mongo, see http://www.mongodb.org.'
AUTHOR = 'Jim Menard' AUTHOR = 'Jim Menard'

View File

@ -252,7 +252,7 @@ class BSON
end end
def deserialize_dbref_data(buf, key, parent) def deserialize_dbref_data(buf, key, parent)
ns = deserialize_cstr(buf) ns = deserialize_string_data(buf)
oid = deserialize_oid_data(buf) oid = deserialize_oid_data(buf)
XGen::Mongo::Driver::DBRef.new(parent, key, @db, ns, oid) XGen::Mongo::Driver::DBRef.new(parent, key, @db, ns, oid)
end end
@ -275,9 +275,7 @@ class BSON
end end
def serialize_dbref_element(buf, key, val) def serialize_dbref_element(buf, key, val)
buf.put(REF) serialize_string_element(buf, key, val.namespace, REF)
self.class.serialize_cstr(buf, key)
self.class.serialize_cstr(buf, val.namespace)
buf.put_array(val.object_id.to_a) buf.put_array(val.object_id.to_a)
end end