Menu Docs

Obter conselhos sobre esquema

Provides schema improvement recommendations for your cluster by analyzing your 20 most active collections.

URL base: https://cloud.mongodb.com/api/public/v1.0

GET /groups/{PROJECT-ID}/performanceAdvisor/schemaAdvice
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.

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 null if you want schema advice for a standalone instance using the hostId.

hostId

string

Unique identifier of the standalone instance for which you want schema advice. Required if clusterId is null.

Este endpoint não usa parâmetros do corpo da solicitação HTTP.

Nome
Tipo
Descrição

content

list of objects

Contains suggested actions for schema improvement per namespace.

content.recommendations

objeto

Namespaces with Assistente de desempenho schema improvement suggestions.

content.recommendations .affectedNamespaces

array

List of namespaces and information on why those namespaces triggered a recommendation.

content.recommendations .affectedNamespaces.namespace

string

Namespace of the affected collection. This is null for the REDUCE_NUMBER_OF_NAMESPACES recommendation.

content.recommendations .affectedNamespaces.triggers

objeto

Details about the trigger that activated the recommendation.

content.recommendations .affectedNamespaces.triggers .description

string

Description of the trigger type.

content.recommendations .affectedNamespaces.triggers .triggerType

string

Type of trigger. Options include:

  • PERCENT_QUERIES_USE_LOOKUP

  • NUMBER_OF_QUERIES_USE_LOOKUP

  • DOCS_CONTAIN_UNBOUNDED_ARRAY

  • NUMBER_OF_NAMESPACES

  • DOC_SIZE_TOO_LARGE

  • NUM_INDEXES

  • QUERIES_CONTAIN_CASE_INSENSITIVE_REGEX

content.recommendations .description

string

Description of the specified recommendation.

content.recommendations .recommendation

string

Type of recommendation. Options include:

  • REDUCE_LOOKUP_OPS

  • AVOID_UNBOUNDED_ARRAY

  • REDUCE_DOCUMENT_SIZE

  • REMOVE_UNNECESSARY_INDEXES

  • REDUCE_NUMBER_OF_NAMESPACES

  • OPTIMIZE_CASE_INSENSITIVE_REGEX_QUERIES

  • OPTIMIZE_TEXT_QUERIES

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'
HTTP/1.1 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
HTTP/1.1 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}
{
"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
}