AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。

スキーマのアドバイスを取得する

20 の最もアクティブなコレクションを分析することで、クラスターのスキーマ改善に関する推奨事項を提供します。

ベース URL: https://cloud.mongodb.com/api/public/v1.0

GET /groups/{PROJECT-ID}/performanceAdvisor/schemaAdvice
Parameter
タイプ
説明

プロジェクトID

string

(必須。)このMongoDBデプロイを所有するプロジェクトの一意の識別子です。グループとプロジェクトは同義語です。グループ ID はプロジェクトIDと同じです。

clusterId または hostId が必要です。

Parameter
タイプ
説明

pretty

ブール値

レスポンス本体を pretty-print 形式にするかどうかを示します。

envelope

ブール値

応答をエンベロープでラップするかどうかを示します。

clusterId

string

レプリカセットまたはシャーディングされたクラスターの一意の識別子です。hostId を使用してスタンドアロンインスタンスのスキーマアドバイスが必要な場合は、このパラメータを null に設定します。

hostId

string

スキーマのアドバイスが必要なスタンドアロンインスタンスの一意の識別子。clusterId が null の場合は必須です。

このエンドポイントは、HTTP リクエスト本体パラメータを使用しません。

名前
タイプ
説明

content

オブジェクトのリスト

名前空間ごとのスキーマ改善に推奨されるアクションが含まれています。

content.recommendations

オブジェクト

Performance Advisorスキーマの改善に関する提案を持つ名前空間。

content.recommendations .affectedNamespaces

配列

名前空間のリストと、それらの名前空間が推奨をトリガーした理由に関する情報。

content.recommendations .affectedNamespaces.namespace

string

影響を受けるコレクションの名前空間。これは REDUCE_NUMBER_OF_NAMESPACES の推奨事項に対する null です。

content.recommendations .affectedNamespaces.triggers

オブジェクト

推奨事項をアクティブ化した trigger の詳細。

content.recommendations .affectedNamespaces.triggers .description

string

trigger の種類の説明。

content.recommendations .affectedNamespaces.triggers .triggerType

string

trigger のタイプ。オプションは次のとおりです。

  • 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

指定された推奨事項の説明。

content.recommendations .recommendation

string

推奨のタイプ。オプションは次のとおりです。

  • 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 UnauthorizedContent-Type: application/json;charset=ISO-8859-1Date: {dateInUnixFormat}WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=falseContent-Length: {requestLengthInBytes}Connection: keep-alive
HTTP/1.1 200 OKVary: Accept-EncodingContent-Type: application/jsonStrict-Transport-Security: max-age=300Date: {dateInUnixFormat}Connection: keep-aliveContent-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}