Method: Mongo::ObjectID#initialize
- Defined in:
- lib/mongo/types/objectid.rb
#initialize(data = nil) ⇒ ObjectID
Create a new object id. If no parameter is given, an id corresponding to the ObjectID BSON data type will be created. This is a 12-byte value consisting of a 4-byte timestamp, a 3-byte machine id, a 2-byte process id, and a 3-byte counter.
37 38 39 |
# File 'lib/mongo/types/objectid.rb', line 37 def initialize(data=nil) @data = data || generate end |