Socket
Book a DemoInstallSign in
Socket

@voiceflow/nestjs-mongodb

Package Overview
Dependencies
Maintainers
27
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@voiceflow/nestjs-mongodb

MongoDB for NestJS

unpublished
Source
npmnpm
Version
1.3.2
Version published
Weekly downloads
0
Maintainers
27
Weekly downloads
 
Created
Source

NestJS MongoDB

MongoDB, but for NestJS

Installation

yarn add @voiceflow/nestjs-mongodb mongodb
yarn add -D @types/mongodb

Usage

The mongo module can be setup in a couple different ways using forRootAsync:

  • A MongoOptions object can be provided via useValue.
  • A useFactory function can be provided to return a MongoOptions object (or a promise for one!).
  • A class implementing MongoOptions can be provided using useClass.
import { MongoModule, MongoService, MongoOptions } from '@voiceflow/nestjs-mongodb';

@Module({
  imports: [
    MongoModule.forRootAsync({
      imports: [],

      // Union field, one of `useValue`, `useFactory`, or `useClass`:
      useValue: {
        url: 'mongodb://<auth>@<your-mongo-db-address>/<db_name>?<params>',
      },
      useFactory: () => getMongoConfig(),
      useClass: MongoConfigService,
    }),
  ],
})
export class AppModule {}

If you have an existing redis connection that you'd like to reuse, you can provide that in forRoot.

import { MongoClient } from 'mongodb';

const mongoConnection = MongoClient.connect(...)

@Module({
  imports: [
    MongoModule.forRoot(mongoConnection),
  ],
})
export class AppModule {}

Once the MongoModule is globally registered, MongoService can be injected in other providers without having to import MongoModule again.

Keywords

mongo

FAQs

Package last updated on 24 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts