Obter conselhos sobre esquema
Nesta página
- A autenticação OAuth 2.0 para acesso programático ao Cloud Manager está disponível como um recurso de visualização.
- O recurso e a documentação correspondente podem mudar a qualquer momento durante o período de Pré-visualização. Para usar a 2.0 autenticação OAuth, crie uma conta de serviço para usar em suas solicitações para a API pública do Cloud Manager .
Provides schema improvement recommendations for your cluster by analyzing your 20 most active collections.
URL base: https://cloud.mongodb.com/api/public/v1.0
Resource
GET /groups/{PROJECT-ID}/performanceAdvisor/schemaAdvice
Parâmetros do caminho da solicitação
Parâmetro | Tipo | Descrição |
---|---|---|
ID do projeto | string | (Required.) Unique identifier of the project that owns this MongoDB deployment. Groups and projects are synonymous terms. Your group ID is the same as your project ID. |
Solicitar parâmetros de query
Either clusterId
or hostId
is required.
Parâmetro | Tipo | Descrição |
---|---|---|
pretty | booleano | Indica se o corpo da resposta deve estar em formato prettyprint. |
envelope | booleano | Indica se deseja ou não envolver a resposta em um envelope. |
clusterId | string | Unique identifier of a replica set or sharded cluster. Set this parameter
to |
hostId | string | Unique identifier of the standalone instance for which you want schema advice.
Required if |
Parâmetros do corpo da solicitação
Este endpoint não usa parâmetros do corpo da solicitação HTTP.
Resposta
Nome | Tipo | Descrição |
---|---|---|
| list of objects | Contains suggested actions for schema improvement per namespace. |
| objeto | Namespaces with Assistente de desempenho schema improvement suggestions. |
| array | List of namespaces and information on why those namespaces triggered a recommendation. |
| string | Namespace of the affected collection. This is |
| objeto | Details about the trigger that activated the recommendation. |
| string | Description of the trigger type. |
| string | Type of trigger. Options include:
|
| string | Description of the specified recommendation. |
| string | Type of recommendation. Options include:
|
Exemplo de solicitação
curl --user '{PUBLIC-KEY}:{PRIVATE-KEY}' --digest \ --header 'Accept: application/json' \ --include \ --request GET 'https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/performanceAdvisor/schemaAdvice?clusterId={clusterId}&pretty=true'
Exemplo de resposta
Cabeçalho de resposta
401 Unauthorized Content-Type: application/json;charset=ISO-8859-1 Date: {dateInUnixFormat} WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false Content-Length: {requestLengthInBytes} Connection: keep-alive
200 OK Vary: Accept-Encoding Content-Type: application/json Strict-Transport-Security: max-age=300 Date: {dateInUnixFormat} Connection: keep-alive Content-Length: {requestLengthInBytes} X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
Corpo de resposta
{ "content" : { "recommendations" : [ { "affectedNamespaces" : [ { "namespace" : "someDb.someCollection", "triggers" : [ { "description" : "Documents larger than 2 MB found in the collection(s) scanned", "triggerType" : "DOC_SIZE_TOO_LARGE" } ] }, { "namespace" : "someDb1.someCollection1", "triggers" : [ { "description" : "Documents larger than 2 MB found in the collection(s) scanned", "triggerType" : "DOC_SIZE_TOO_LARGE" } ] } ], "description" : "Reduce the size of documents", "recommendation" : "REDUCE_DOCUMENT_SIZE" }, { "affectedNamespaces" : [ { "namespace" : "someDb2.someCollection2", "triggers" : [ { "description" : "More than 30 indexes detected in the collection(s) scanned", "triggerType" : "NUM_INDEXES" } ] }, { "namespace" : "someDb3.someCollection3", "triggers" : [ { "description" : "More than 30 indexes detected in the collection(s) scanned", "triggerType" : "NUM_INDEXES" } ] } ], "description" : "Remove unnecessary indexes", "recommendation" : "REMOVE_UNNECESSARY_INDEXES" }, { "affectedNamespaces" : [ { "namespace" : "someDb4.someCollection4", "triggers" : [ { "description" : "Arrays with over 10000 entries detected in the collection(s) scanned", "triggerType" : "DOCS_CONTAIN_UNBOUNDED_ARRAY" } ] } ], "description" : "Avoid using unbounded arrays in documents", "recommendation" : "AVOID_UNBOUNDED_ARRAY" } ] }, "status" : 200 }