Docs Menu
Docs Home
/ /

Data Explorerのインテリジェント 支援

インテリジェントアシスタントは、Data Explorerの統合MongoDB開発サポート用に設計されたAI搭載のツールです。自然言語の質問に答え、デバッグ エラーを支援し、パフォーマンス最適化のためのガイダンスを提供します。

Data Explorerでインテリジェント 支援を使用するには、まず 設定でAI機能を有効にします。

組織レベルで、次の操作を行います。

1
  1. まだ表示されていない場合は、以下から目的の組織を選択しますナビゲーション バーのOrganizationsメニュー

  2. サイドバーで、Organization Settings をクリックします。

[ 組織設定]ページが表示されます。

2

プロジェクトレベルで、次の操作を行います。

1
  1. まだ表示されていない場合は、希望するプロジェクトを含む組織を選択しますナビゲーション バーのOrganizationsメニュー

  2. まだ表示されていない場合は、ナビゲーション バーのProjectsメニューから目的のプロジェクトを選択します。

  3. サイドバーで、Project Settings をクリックします。

[ Project Settings ]ページが表示されます。

2

Enable Data Explorer Generative AI Features トグルを on に設定します。

3

Data Explorerでの生成系AI の使用の詳細については、以下を参照してください。

  • AI とデータ使用状況に関する情報

  • MongoDB の生成系 AI 機能に関する FAQ

インテリジェント エージェントにアクセスするには、次の手順に従います。

1
  1. まだ表示されていない場合は、プロジェクトを含む組織をナビゲーション バーの Organizations メニューで選択します。

  2. まだ表示されていない場合は、ナビゲーション バーの Projects メニューからプロジェクトを選択します。

  3. サイドバーで、 Database見出しの下のData Explorerをクリックします。

    Data Explorerが表示されます。

AIドライバーが折りたたまれたData Explorerページ
クリックして拡大します

図の 1。支援が折りたたまれた状態のData Explorer のホームページ。

AI引数が開かれたデータ エクスプローラーページ
クリックして拡大します

図の 2。支援が展開されたData Explorer のホームページ。

Data Explorer の 支援の読み取り専用ツールは、現在のタスクからコンテキストを取得したり、人間の承認を使用して接続されたMongoDBデプロイに対してデータベース操作を実行したりします。対話の応答とは異なり、これらのツールは実際のデータベースクエリを実行し、データベースからライブデータを返す場合があります 。

支援ツールには、次の重要な特徴があります。

  • 読み取り専用: ツールはデータを変更、挿入、アップデート、または削除できません。

  • ユーザー認証: すべてのツールを実行するには明示的なユーザー確認が必要です。

  • コンテキスト: ツールを呼び出す際に、現在のデータベース、コレクション、および接続の を利用します。

  • ライブ データ: 接続されたMongoDBデプロイから結果がリアルタイムで送信されます。

次のツールはユーザーの機密情報を取得し、確認を要求します。これらのツールはデータベースとはやり取りしませんが、使用する前にユーザーの確認が必要です。

Data Explorerツール名
説明

get-current-query

クエリ バーからアクティブなMongoDBクエリ パラメータを抽出します

get-current-pipeline

集計ビルダからアクティブな集計パイプラインを抽出します

データベースツール名
説明

list-databases

MongoDBデプロイで使用可能なすべてのデータベースと、そのストレージサイズを表示。

list-collections

特定のデータベース内のすべてのコレクションを表示します。

find

コレクションから特定の検索条件に一致する実際のドキュメントを検索します。

count

ドキュメント自体を取得せずに、コレクション内のドキュメントの合計数をすばやく返します。

aggregate

グループ化、フィルタリング、変換、ドキュメント全体の統計情報の計算など、複雑なデータ処理操作を実行します。

collection-indexes

コレクションで定義されているすべてのインデックスを一覧表示します。

collection-schema

コレクションを分析して、フィールド名やデータ型などのドキュメントの構造を明示します。

collection-storage-size

データとインデックスの両方を含むコレクションが占有する物理ディスク領域を報告します。

db-stats

コレクション数、ドキュメント合計、ストレージ使用状況、インデックス統計など、データベースの健全性の包括的な概要を提供します。

mongodb-logs

トラブルシューティング、パフォーマンス モニタリング、セキュリティ監査のために最近のサーバーログを取得します。

explain

詳細なクエリ実行プランとパフォーマンス統計を表示し、 MongoDB がクエリをどのように処理するか、またインデックスを使用しているかどうかを示します。

注意

集計パイプラインステージ $out$merge は書込み操作を実行するため、ツール呼び出しではサポートされていません。支援は読み取り専用ツールのみをサポートします。

1

ツールはデフォルトで有効になっていますが、入力バーの Tools ボタンを使用してオンまたはオフを切り替えることができます。

2

アクティブな接続を持ち、関連するページを表示していることを確認します。質問をするには、アクティブな接続に関連するタブが必要です。

3

データに関するクエリのプロンプトを送信します(例: すべてのデータベースを一覧表示する)。

4

エージェントはユーザーの意向を検出し、保留状態でツール カードを表示します。このリストは、ツール カードが表示できる要素を列挙したものです。

  • ツール名の操作

  • 配置(ホスト/エンドポイント)

  • クエリ対象のデータベースとコレクション

  • パラメータまたはフィルター

  • Run ボタンと Cancel ボタン

上記の例では 、ツール カードには「list-databases」が表示されています。

5
6

結果の例:

Here are the databases found on your MongoDB deployment:
- sample_mflix (Size: 183,685,120 bytes)
- admin (Size: 364,544 bytes)
- local (Size: 21,907,722,240 bytes)
If you want details about collections in any of these databases,
just let me know!

次のシナリオでは、 Data Explorerのインテリジェント 支援の使用例を示します。

インテリジェント エージェントに、MongoDB Compassクエリの出力を分析するようリクエストします。

Interpret this explain plan for me.
## Summary
- **Query Logic:** This pipeline counts the number of Italian restaurants in Manhattan by first filtering documents and then aggregating the count.
- **Performance:** Fair
- **Recommendations:** Create a compound index on `{ borough: 1, cuisine: 1 }` to optimize document retrieval.
## Details
### Query Logic
1. `$match`: Filters documents where `borough` is "Manhattan" and `cuisine` is "Italian".
2. `$count`: Counts the number of documents matching the filter and outputs the total.
### Performance Analysis
- The winning plan uses an index scan on the `cuisine` field (`cuisine_1`) and applies an in-memory filter for `borough` ("Manhattan").
- Both `totalKeysExamined` and `totalDocsExamined` are high (43,207), which implies that every document with `cuisine: "Italian"` is examined and then filtered by `borough`.
- No compound index exists, meaning MongoDB cannot efficiently combine both filter criteria in a single index lookup.
- The pipeline does properly filter before counting, but index usage is only partial, causing increased resource usage.
### Recommendations
- Create a compound index on `{ borough: 1, cuisine: 1 }` to allow MongoDB to retrieve documents matching both criteria directly from the index, minimizing documents examined.
- This optimization will reduce execution time and system load without changing the output of your aggregation pipeline.
Below is the recommended Aggregation Pipeline. This optimized Aggregation Pipeline will leverage the compound index to scan fewer documents, as both filter criteria are present in the index.
```json
[
{ "$match": { "borough": "Manhattan", "cuisine": "Italian" } },
{ "$count": "totalItalianRestaurants" }
]
```
### Follow-Up Questions
1. How do I create a compound index in MongoDB Compass or via a shell command?
2. What other fields should I consider adding to my indexes for restaurant lookups?
3. How can I further optimize aggregations when working with larger datasets?

次の例は、 Data Explorer の関数とクエリについて、インテリジェント エージェントに質問できることを示しています。

How is MongoDB data modeling different from data modeling with a relational
database?
MongoDB data modeling differs from relational database (RDBMS) data
modeling in some important ways:
1. Document-Oriented vs. Table-Oriented
- MongoDB stores data as flexible, hierarchical JSON-like documents.
- Relational databases use tables with fixed schemas and columns.
2. Schema Flexibility
- In MongoDB, collections can contain documents with different structures. Schema enforcement is optional.
- RDBMS tables have a strict schema that enforces data types and relationships.
3. Embedding vs. Normalization
- MongoDB encourages embedding related data inside documents when appropriate (denormalization). Example: An order document may include an array of items directly inside it.
- Relational databases emphasize normalization—splitting data across tables connected by foreign keys.
4. Relationships
- MongoDB does support references between documents (similar to foreign keys), but joins are less central and not as efficient as in RDBMS.
- RDBMSs use normalized data and JOIN operations to relate tables efficiently.
5. Performance & Scaling
- MongoDB’s data model enables horizontal scaling (sharding), making it well-suited for large, distributed datasets.
- RDBMS scaling typically relies on vertical scaling or complex clustering; JOINs can become expensive as data grows.
6. Use Cases and Design Philosophy
- MongoDB models are often designed to optimize common query patterns, reducing the need for joins and complex queries.
- RDBMS models are designed for transactional consistency and for representing organized, well-structured relationships.
In summary, MongoDB encourages a more flexible, application-driven
approach to modeling, while relational databases rely on rigid schemas
and normalized relationships. Compass provides tools to visually explore
your document structures and relationships, which can be especially
helpful as your model evolves.
How can I combine multiple conditions in a single $search query?
To combine multiple conditions in a single $search query in MongoDB Atlas
Search (including Compass), you should use the compound operator. The
compound operator allows you to specify multiple criteria using must,
mustNot, filter, and should clauses.
Example: Combine Multiple Conditions
Suppose you want to:
- Match documents where the plot field contains "baseball"
- Exclude documents where the genres field contains "Comedy" or "Romance"
Your $search stage would look like this:
{
"$search": {
"compound": {
"must": [
{
"text": {
"query": "baseball",
"path": "plot"
}
}
],
"mustNot": [
{
"text": {
"query": ["Comedy", "Romance"],
"path": "genres"
}
}
]
}
}
}

戻る

集計のプロンプト

項目一覧