class Easymongo::Result

Attributes

result[R]

Public Class Methods

new(result) click to toggle source

Init takes a Mongo::Operation::Result

# File lib/easymongo/result.rb, line 7
def initialize(result)
  @result = result
end

Public Instance Methods

bson_id() click to toggle source

Get the id as BSON::ObjectId

# File lib/easymongo/result.rb, line 12
def bson_id
  result.upserted_id rescue nil
end
date() click to toggle source

Creation date

# File lib/easymongo/result.rb, line 22
def date
  bson_id ? bson_id.generation_time : nil
end
id() click to toggle source

Get the id if available

# File lib/easymongo/result.rb, line 17
def id
  bson_id ? bson_id.to_s : nil
end
method_missing(name, *args, &block) click to toggle source

For the mongo operation result

Calls superclass method
# File lib/easymongo/result.rb, line 27
def method_missing(name, *args, &block)
  return result.send(name, *args) if result.respond_to?(name)
  super
end