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

レジストリインデックスファイルの手動作成

警告

試験用機能

この機能は実験的な機能です。 MongoDB は スニペット のサポートを提供していません。 この機能は、事前の通知なしにいつでも変更または削除される可能性があります。

バグは期待されていませんが、発生した場合はGithubリポジトリでこのプロジェクトの 問題を開いてください 。

このページでは、レジストリ インデックス ファイルを手動で作成する方法について説明します。 スクリプトを使用してレジストリ インデックス ファイルを生成するには、「 レジストリ インデックス ファイルの作成 」を参照してください。

レジストリ インデックス ファイルを作成するには

  1. 次のTypescriptテンプレートをコピーして、make-index.ts として保存します。

    import bson from 'bson';import zlib from 'zlib'; interface ErrorMatcher { // Add additional information to shell errors matching one of the regular. // expressions. The message can point to a snippet helping solve that error. matches: RegExp[]; message: string;} interface SnippetDescription { // The *npm* package name. Users do not interact with this. name: string; // The snippet name. This is what users interact with. snippetName: string; // An optional install specifier that can be used to point npm towards // packages that are not uploaded to the registry. For example, // this could be an URL to a git repository or a tarball. installSpec?: string; // A version field. Users do not interact with this, as currently, `snippet` // always installs the latest versions of snippets. version: string; description: string; readme: string; // License should be a SPDX license identifier. license: string; errorMatchers?: ErrorMatcher[];} interface SnippetIndexFile { // This must be 1 currently. indexFileVersion: 1; index: SnippetDescription[]; metadata: { homepage: string };} const indexFileContents: SnippetIndexFile = { indexFileVersion: 1, index: [ /* ... */ ], metadata: { homepage: 'https://example.com' }}; // Serialize, compress and store the index file:fs.writeFileSync('index.bson.br', zlib.brotliCompressSync( bson.serialize(indexFileContents)));
  2. スニペット パッケージに必要に応じてmake-index.tsを編集します。 コメントをガイドとして、必要な情報を入力します。

  3. ts-node make-index.tsを実行してindex.bson.br file を作成します。

  4. index.bson.br をGithubリポジトリにアップロードします。

  5. index.bson.brを参照する URL を含めるようにsnippetIndexSourceURLsを更新します。

このページを評価