diff --git a/lib/bson/array.rb b/lib/bson/array.rb index 19d1af812..5a869ebe1 100644 --- a/lib/bson/array.rb +++ b/lib/bson/array.rb @@ -110,6 +110,11 @@ module ClassMethods # Deserialize the array from BSON. # + # @note If the argument cannot be parsed, an exception will be raised + # and the argument will be left in an undefined state. The caller + # must explicitly call `rewind` on the buffer before trying to parse + # it again. + # # @param [ ByteBuffer ] buffer The byte buffer. # # @option options [ nil | :bson ] :mode Decoding mode to use. diff --git a/lib/bson/hash.rb b/lib/bson/hash.rb index 78d40e60f..794d5d8bb 100644 --- a/lib/bson/hash.rb +++ b/lib/bson/hash.rb @@ -97,6 +97,11 @@ module ClassMethods # Deserialize the hash from BSON. # + # @note If the argument cannot be parsed, an exception will be raised + # and the argument will be left in an undefined state. The caller + # must explicitly call `rewind` on the buffer before trying to parse + # it again. + # # @param [ ByteBuffer ] buffer The byte buffer. # # @option options [ nil | :bson ] :mode Decoding mode to use. diff --git a/lib/bson/regexp.rb b/lib/bson/regexp.rb index 15157979c..193620e8d 100644 --- a/lib/bson/regexp.rb +++ b/lib/bson/regexp.rb @@ -271,6 +271,11 @@ module ClassMethods # Deserialize the regular expression from BSON. # + # @note If the argument cannot be parsed, an exception will be raised + # and the argument will be left in an undefined state. The caller + # must explicitly call `rewind` on the buffer before trying to parse + # it again. + # # @param [ ByteBuffer ] buffer The byte buffer. # # @option opts [ nil | :bson ] :mode Decoding mode to use.