CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-nestjs--mongoose

NestJS module that provides seamless integration between NestJS and Mongoose ODM for MongoDB database operations

80

1.02x
Quality

Pending

Does it follow best practices?

Impact

80%

1.02x

Average score across 10 eval scenarios

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

task.mdevals/scenario-3/

Mongo Connection Module

Create a NestJS module that configures a MongoDB connection for the application. The module should support both synchronous and asynchronous configuration paths and allow consumers to request either the default connection or a named connection.

Capabilities

Synchronous connection setup

  • Registering the module with a MongoDB URI and optional database name produces a NestJS module that starts with a live connection and exposes an injectable connection token usable by providers. @test

Asynchronous options factory

  • Registering the module with an async options factory waits for the factory result before creating the connection and passes through properties such as URI, database name, retry attempts, and retry delay. @test

Custom connection name

  • Providing a connection name yields an injectable connection token scoped to that name while keeping the default connection unchanged. @test

Implementation

@generates

API

export interface DatabaseModuleOptions {
  uri: string;
  dbName?: string;
  connectionName?: string;
  retryAttempts?: number;
  retryDelay?: number;
  lazyConnection?: boolean;
}

export interface DatabaseModuleAsyncOptions {
  useFactory: (...args: any[]) => Promise<DatabaseModuleOptions> | DatabaseModuleOptions;
  inject?: any[];
  connectionName?: string;
}

export class DatabaseModule {
  static register(options: DatabaseModuleOptions): DynamicModule;
  static registerAsync(options: DatabaseModuleAsyncOptions): DynamicModule;
}

Dependencies { .dependencies }

@nestjs/mongoose { .dependency }

Provides NestJS integration with MongoDB connections and injectable connection tokens.

@nestjs/config { .dependency }

Supplies configuration values for building async database options.

tile.json