class BSON::DBRef
A reference to another object in a MongoDB database.
Attributes
namespace[R]
object_id[R]
Public Class Methods
new(namespace, object_id)
click to toggle source
Create a DBRef. Use this class in conjunction with DB#dereference.
@param [String] namespace a collection name. @param [ObjectId] #object_id an object id.
# File lib/bson/types/dbref.rb, line 26 def initialize(namespace, object_id) @namespace = namespace @object_id = object_id end
Public Instance Methods
to_hash()
click to toggle source
# File lib/bson/types/dbref.rb, line 35 def to_hash {"$ns" => @namespace, "$id" => @object_id } end
to_s()
click to toggle source
# File lib/bson/types/dbref.rb, line 31 def to_s "ns: #{namespace}, id: #{object_id}" end