スキーマのアドバイスを取得する
- Cloud Managerへのプログラムによるアクセスのための OAuth 2.0認証はプレビュー機能として利用できます。
- 機能および関連するドキュメントは、プレビュー期間中にいつでも変更される可能性があります。 OAuth2.0 認証を使用するには、 Cloud Manager Public APIへのリクエストで使用する サービス アカウント を作成します。
20 の最もアクティブなコレクションを分析することで、クラスターのスキーマ改善に関する推奨事項を提供します。
ベース URL: https://cloud.mongodb.com/api/public/v 1.0
Resource
GET /groups/{PROJECT-ID}/performanceAdvisor/schemaAdvice
リクエスト パス パラメーター
Parameter | タイプ | 説明 |
---|---|---|
プロジェクトID | string | (必須。)このMongoDBデプロイを所有するプロジェクトの一意の識別子です。グループとプロジェクトは同義語です。グループ ID はプロジェクトIDと同じです。 |
リクエスト クエリ パラメータ
clusterId
または hostId
のいずれかが必要です。
Parameter | タイプ | 説明 |
---|---|---|
pretty | ブール値 | レスポンス本体を pretty-print にするかどうかを示します 形式。 |
envelope | ブール値 | 応答をエンベロープでラップするかどうかを示します。 |
clusterId | string | レプリカセットまたはシャーディングされたクラスターの一意の識別子です。 |
hostId | string | スキーマのアドバイスが必要なスタンドアロンインスタンスの一意の識別子。 |
リクエスト ボディ パラメータ
このエンドポイントは、HTTP リクエスト本体パラメータを使用しません。
応答
名前 | タイプ | 説明 |
---|---|---|
| オブジェクトのリスト | 名前空間ごとのスキーマ改善に推奨されるアクションが含まれています。 |
| オブジェクト | Performance Advisorスキーマの改善に関する提案を持つ名前空間。 |
| 配列 | 名前空間のリストと、それらの名前空間が推奨をトリガーした理由に関する情報。 |
| string | 影響を受けるコレクションの名前空間。これは |
| オブジェクト | 推奨事項をアクティブ化した trigger の詳細。 |
| string | trigger の種類の説明。 |
| string | trigger のタイプ。オプションは次のとおりです。
|
| string | 指定された推奨事項の説明。 |
| string | 推奨のタイプ。オプションは次のとおりです。
|
リクエストの例
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'
応答例
応答ヘッダー
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}
レスポンス本体
{ "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 }