Para agentes de IA: hay un índice de documentación disponible en https://www.mongodb.com/es/docs/llms.txt — versiones en markdown de todas las páginas están disponibles agregando .md a cualquier ruta URL.
Docs Menu

Crear un archivo de índice de registro manualmente

Advertencia

Funcionalidad experimental

Esta funcionalidad es experimental. MongoDB no proporciona soporte para Fragmentos. Esta funcionalidad puede ser cambiada o eliminada en cualquier momento sin previo aviso.

No se esperan errores, sin embargo, si encuentras uno, abre un issue en el repositorio de GitHub de este proyecto.

Cette page explique comment créer manuellement un fichier d’index de registre. Para generar el archivo de índice de registro usando un script, vea Crear un archivo de índice de registro.

Para crear el archivo de índice del registro:

  1. Copia la siguiente plantilla de TypeScript y guárdala como 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. Edita make-index.ts según sea necesario para tu paquete de snippet. Utilice los comentarios como guía para completar la información requerida.

  3. Ejecute ts-node make-index.ts para crear el index.bson.br file.

  4. Carga index.bson.br a tu repositorio de GitHub.

  5. Actualiza snippetIndexSourceURLs para incluir una URL que haga referencia a tu index.bson.br.