Learn the "why" behind slow queries and how to fix them in our 2-Part Webinar.
Register now >
Docs Menu
Docs Home
/ /

Compass でのエンティティ関係図の生成

Compass で、データモデルをエンティティ関係図として可視化化します。エンティティ関係図を使用すると、データベース内のデータ間の関係を理解してドキュメント、スキーマ の変更を計画するのに役立ちます。

図の生成後にデータに変更を加えた場合、Compass は図を自動的に更新しません。変更を確認するには、新しい図を作成する必要があります。

Compass でエンティティ関係図を生成するには、データベースに少なくとも 1 つのデータを含むコレクションが必要です。

1

左側のサイドバーで、 Data Modeling をクリックします。

2

Data Modelingタブに保存されている既存の図がある場合は、画面の右上隅にある Generate new diagram をクリックして新しい図を作成できます。

3

New diagram setupモーダルで次の操作を行います。

  • 図の生成に使用するMongoDB接続を選択します。

  • データモデル図に使用するデータベースを選択します。

  • 図の名前を入力します。

各フィールドを指定した後、Next をクリックします。

4

チェックボックスを使用して、データモデル図に含めるコレクションを選択します。検索バーを使用して、特定のコレクションをフィルタリングすることもできます。

After you select your collections, click Next.

5

Diagram Settings モーダルでは、コレクション間で Automatically infer relationships を選択できます。有効にすると、Compass は選択したコレクションを分析し、他のコレクションへの参照を含むインデックス付きフィールドに基づいて関係を追加します。

図を生成した後、関係を手動で追加および編集することもできます。

注意

関係は注釈のみを目的としています。Compass は関係情報をMongoDBデータベースに保存しません。

6

In the Diagram Settings modal, you can specify how many documents Compass samples from your collections to generate your diagram. By default, Compass samples 100 documents per collection.

Larger sample sizes improve accuracy but may increase analysis time and memory usage. Smaller sample sizes decrease analysis time and memory usage but may miss infrequent fields or relationships.

You can also select whether you want to generate a diagram that samples all documents in your collections. Consider the size of your dataset and available resources on your device before you select All documents.

7

Compass は、選択したコレクションを使用してエンティティ関係図を生成し、現在のタブに表示します。Compass には Data Model Overview サイド パネルも表示され、図の名前を変更したり、次の情報を表示したりできます。

  • 図の生成に使用したデータベース

  • 図を最初に生成したとき

  • 図を最後に更新したとき

図を生成すると、Compass は Data Modelingタブに既存の図を表示します。

注意

図内のコレクションまたはフィールドをクリックすると、サイド パネルにコレクションまたはフィールドに関する情報が表示されます。Data Model Overview に戻すには、図内の空のスペースをクリックして、コレクションまたはフィールドの選択を解除します。

  • MongoDBでのデータモデリング

  • MongoDB Compassでのデータモデリング

戻る

データモデリング

項目一覧