lib/mongo/grid/file/info.rb in mongo-2.2.7 vs lib/mongo/grid/file/info.rb in mongo-2.3.0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (C) 2014-2015 MongoDB, Inc. +# Copyright (C) 2014-2016 MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # @@ -17,10 +17,13 @@ class File # Encapsulates behaviour around GridFS files collection file document. # # @since 2.0.0 + # + # @deprecated Please use the 'stream' API on a FSBucket instead. + # Will be removed in driver version 3.0. class Info # Name of the files collection. # # @since 2.0.0 @@ -191,15 +194,16 @@ # from the server and is not a new file) then we digest the md5 and set it. # # @example Convert the file information document to BSON. # file_info.to_bson # - # @param [ String ] encoded The encoded data to append to. + # @param [ BSON::ByteBuffer ] buffer The encoded BSON buffer to append to. + # @param [ true, false ] validating_keys Whether keys should be validated when serializing. # # @return [ String ] The raw BSON data. # # @since 2.0.0 - def to_bson(buffer = BSON::ByteBuffer.new, validating_keys = nil) + def to_bson(buffer = BSON::ByteBuffer.new, validating_keys = BSON::Config.validating_keys?) document[:md5] ||= @client_md5.hexdigest document.to_bson(buffer) end # Get the upload date.