lib/easymongo/result.rb in easymongo-0.0.3 vs lib/easymongo/result.rb in easymongo-0.0.4

- old
+ new

@@ -1,20 +1,17 @@ module Easymongo class Result - attr_accessor :result, :data, :values, :options + attr_reader :result # Init takes a Mongo::Operation::Result - def initialize(result, data, values = nil, options = nil) - self.result = result - self.data = data - self.values = values - self.options = options + def initialize(result) + @result = result end # Get the id as BSON::ObjectId def bson_id - result.upserted_id || data['_id'] + result.upserted_id rescue nil end # Get the id if available def id bson_id ? bson_id.to_s : nil