Skip to content

InjectConnection not supported? #499

@bneigher

Description

@bneigher

I'm looking for similar behavior as @nestjs/mongoose:

import { Injectable, Logger } from '@nestjs/common';
import { InjectConnection } from '@nestjs/mongoose';

@Injectable()
export class MyService {
  private readonly logger = new Logger(MyService.name);

  // eslint-disable-next-line no-useless-constructor
  constructor(
    @InjectConnection() private dbConnection: Connection,
  ) {}


  async test() {
    const transaction = await this.dbConnection.startSession();
    await transaction.withTransaction(async () => { ... /* my transactions */ ... })
    transaction.endSession();
    return
  }
}

Is this something that we can add to the lib?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions