Get Schema Advice
On this page
- OAuth 2.0 authentication for programmatic access to Cloud Manager is available as a Preview feature.
- The feature and the corresponding documentation might change at any time during the Preview period. To use OAuth 2.0 authentication, create a service account to use in your requests to the Cloud Manager Public API.
Provides schema improvement recommendations for your cluster by analyzing your 20 most active collections.
Base URL: https://cloud.mongodb.com/api/public/v1.0
Resource
GET /groups/{PROJECT-ID}/performanceAdvisor/schemaAdvice
Request Path Parameters
Parameter | Type | Description |
---|---|---|
PROJECT-ID | 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. |
Request Query Parameters
Either clusterId
or hostId
is required.
Parameter | Type | Description |
---|---|---|
pretty | boolean | Indicates whether the response body should be in a prettyprint format. |
envelope | boolean | Indicates whether or not to wrap the response in an 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 |
Request Body Parameters
This endpoint doesn't use HTTP request body parameters.
Response
Name | Type | Description |
---|---|---|
| list of objects | Contains suggested actions for schema improvement per namespace. |
| object | Namespaces with Performance Advisor schema improvement suggestions. |
| array | List of namespaces and information on why those namespaces triggered a recommendation. |
| string | Namespace of the affected collection. This is |
| object | 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:
|
Example Request
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'
Example Response
Response Header
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}
Response Body
{ "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 }