use BSON::ObjectId rather than Mongo::ObjectId for return values in doc
This commit is contained in:
parent
e2178b0f1d
commit
1b595316c6
@ -68,7 +68,7 @@ module BSON
|
||||
# succeeding the timestamp will be zeroed; if true, they'll
|
||||
# consist of the standard machine id, pid, and counter.
|
||||
#
|
||||
# @return [Mongo::ObjectId]
|
||||
# @return [BSON::ObjectId]
|
||||
#
|
||||
# @example Return all document created before Jan 1, 2010.
|
||||
# time = Time.utc(2010, 1, 1)
|
||||
@ -87,7 +87,7 @@ module BSON
|
||||
#
|
||||
# @param [Hash] doc a document requiring an _id.
|
||||
#
|
||||
# @return [Mongo::ObjectId, Object] returns a newly-created or
|
||||
# @return [BSON::ObjectId, Object] returns a newly-created or
|
||||
# current _id for the given document.
|
||||
def self.create_pk(doc)
|
||||
doc.has_key?(:_id) || doc.has_key?('_id') ? doc : doc.merge!(:_id => self.new)
|
||||
@ -121,7 +121,7 @@ module BSON
|
||||
#
|
||||
# @param [String] str
|
||||
#
|
||||
# @return [Mongo::ObjectId]
|
||||
# @return [BSON::ObjectId]
|
||||
def self.from_string(str)
|
||||
raise InvalidObjectId, "illegal ObjectId format: #{str}" unless legal?(str)
|
||||
data = []
|
||||
|
@ -63,7 +63,7 @@ module Mongo
|
||||
# @option opts [Boolean] :strict (False) If true, collections must exist to be accessed and must
|
||||
# not exist to be created. See DB#collection and DB#create_collection.
|
||||
#
|
||||
# @option opts [Object, #create_pk(doc)] :pk (Mongo::ObjectId) A primary key factory object,
|
||||
# @option opts [Object, #create_pk(doc)] :pk (BSON::ObjectId) A primary key factory object,
|
||||
# which should take a hash and return a hash which merges the original hash with any primary key
|
||||
# fields the factory wishes to inject. (NOTE: if the object already has a primary key,
|
||||
# the factory should not inject a new key).
|
||||
|
@ -63,7 +63,7 @@ module Mongo
|
||||
# @option opts [Boolean] :safe (false) When safe mode is enabled, the chunks sent to the server
|
||||
# will be validated using an md5 hash. If validation fails, an exception will be raised.
|
||||
#
|
||||
# @return [Mongo::ObjectId] the file's id.
|
||||
# @return [BSON::ObjectId] the file's id.
|
||||
def put(data, opts={})
|
||||
opts = opts.dup
|
||||
filename = opts[:filename]
|
||||
|
Loading…
Reference in New Issue
Block a user