Índice de queda de pesquisa
Definição
Novidade na versão 7.0: (Também disponível a partir da versão 6.0.7)
Exclui um índice de Pesquisa do Atlas existente.
O mongosh
método fornece um wrapper em torno db.collection.dropSearchIndex()
do updateSearchIndex
reconhecimento de data center .
Importante
Esse comando só pode ser executado em uma implantação hospedada no MongoDB Atlas e não é suportado em instâncias sem servidor.
Sintaxe
Sintaxe do comando:
db.runCommand( { dropSearchIndex: "<collection name>", id: "<index Id>", name: "<index name>" } )
Campos de comando
O comando dropSearchIndex
usa os seguintes campos:
Campo | Tipo | necessidade | Descrição |
---|---|---|---|
| string | Obrigatório | Name of the collection that contains the index to delete. |
| string | Condicional |
Você deve especificar o campo |
| string | Condicional | Name of the index to delete. Você deve especificar o campo |
Comportamento
After you run the dropSearchIndex
command, there may be a delay between when you
receive a response from the command and when the index is deleted.
To see the status of your search indexes, use the
$listSearchIndexes
aggregation stage. Once your index is
deleted, that index no longer appears in the $listSearchIndexes
output.
Controle de acesso
Se a sua implementação impor o controle de acesso, o usuário executando o comando dropSearchIndex
deverá ter a ação de privilégio do dropSearchIndex
no reconhecimento de data center ou collection:
{ resource: { db : <database>, collection: <collection> }, actions: [ "dropSearchIndex" ] }
Os papéis embutidos dbAdmin
e readWrite
fornecem o privilégio do dropSearchIndex
. O exemplo a seguir concede a role readWrite
no reconhecimento de data center qa
:
db.grantRolesToUser( "<user>", [ { role: "readWrite", db: "qa" } ] )
Saída
Um comando dropSearchIndex
bem-sucedido retorna o seguinte:
{ ok: 1 }
Exemplo
The following example deletes a search index named searchIndex01
on
the contacts
collection:
db.runCommand( { dropSearchIndex: "contacts", name: "searchIndex01" } )