def set(*args)

      # Insert, add oid
      data, values = args.size == 1 ? [{'_id' => oid}, *args] : args

      # Normalize attributes
      data, values = ids(data), ids(values)

      # Using set and unset so we don't store nil in the db
      options = {
        :$set => values.select{|k, v| !v.nil?}, :$unset => values.select{|k, v| v.nil?}
      }.delete_if{|k, v| v.empty?}

      # Update the collection
      result = client[coll].update_one(data, options, :upsert => true)

      # Return result
      Easymongo::Result.new(result)
    end
def set(*args)

      # Insert, add oid
      data, values = args.size == 1 ? [{'_id' => oid}, *args] : args

      # Normalize attributes
      data, values = ids(data), ids(values)

      # Using set and unset so we don't store nil in the db
      options = {
        :$set => values.select{|k, v| !v.nil?}, :$unset => values.select{|k, v| v.nil?}
      }.delete_if{|k, v| v.empty?}

      # Update the collection
      result = client[coll].update_one(data, options, :upsert => true)

      # Return result
      Easymongo::Result.new(result)
    end
Set values