Method: Mongo::SearchIndex::View#update_one

Defined in:
lib/mongo/search_index/view.rb

#update_one(definition, id: nil, name: nil) ⇒ Mongo::Operation::Result

Update the search index with the given id or name. One or the other must be provided, but not both.

Parameters:

  • definition (Hash)

    the definition to replace the given search index with.

  • id (nil | String) (defaults to: nil)

    the id of the search index to update

  • name (nil | String) (defaults to: nil)

    the name of the search index to update

Returns:



139
140
141
142
143
144
145
146
147
148
# File 'lib/mongo/search_index/view.rb', line 139

def update_one(definition, id: nil, name: nil)
  validate_id_or_name!(id, name)

  spec = spec_with(index_id: id, index_name: name, index: definition)
  op = Operation::UpdateSearchIndex.new(spec)
  context = execution_context
  tracer.trace_operation(op, context, op_name: 'updateSearchIndex') do
    op.execute(next_primary, context: context)
  end
end