nestjs-typegoose icon indicating copy to clipboard operation
nestjs-typegoose copied to clipboard

How do I get the 'connection' object of 'mongoose'

Open CodePirate7 opened this issue 6 years ago • 8 comments

I want to use some plugins in mongoose, but the plugins need a 'connection' object. How do I get it?

CodePirate7 avatar Nov 18 '19 14:11 CodePirate7

I was able to get the connection with:

import { getConnectionToken } from 'nestjs-typegoose';

@Injectable()
export class MyService {
  constructor(
    ...
    @Inject(getConnectionToken()) private connection: mongoose.Connection,
    ...
  ) {}
}

andreialecu avatar Dec 04 '19 13:12 andreialecu

@q389491729 which plugin you are talking about? mongoose-auto-increment plugin?

nasr18 avatar Feb 05 '20 15:02 nasr18

yes. mongoose-auto-increment plugin

---Original--- From: "Mohamed Nasrullah"<[email protected]> Date: Wed, Feb 5, 2020 23:19 PM To: "kpfromer/nestjs-typegoose"<[email protected]>; Cc: "Mention"<[email protected]>;"CodePirate"<[email protected]>; Subject: Re: [kpfromer/nestjs-typegoose] How do I get the 'connection' object of 'mongoose' (#46)

@q389491729 which plugin you are talking about? mongoose-auto-increment plugin?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

CodePirate7 avatar Feb 05 '20 16:02 CodePirate7

@q389491729 is that plugin working with nestjs?

nasr18 avatar Feb 05 '20 16:02 nasr18

yes,but I don't know how to do 

---Original--- From: "Mohamed Nasrullah"<[email protected]> Date: Thu, Feb 6, 2020 00:54 AM To: "kpfromer/nestjs-typegoose"<[email protected]>; Cc: "Mention"<[email protected]>;"CodePirate"<[email protected]>; Subject: Re: [kpfromer/nestjs-typegoose] How do I get the 'connection' object of 'mongoose' (#46)

@q389491729 is that plugin working with nestjs?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

CodePirate7 avatar Feb 05 '20 17:02 CodePirate7

Did you made it to work or not?

nasr18 avatar Feb 05 '20 19:02 nasr18

I tried to make it work, but it never worked.

---Original--- From: "Mohamed Nasrullah"<[email protected]> Date: Thu, Feb 6, 2020 03:30 AM To: "kpfromer/nestjs-typegoose"<[email protected]>; Cc: "Mention"<[email protected]>;"CodePirate"<[email protected]>; Subject: Re: [kpfromer/nestjs-typegoose] How do I get the 'connection' object of 'mongoose' (#46)

Did you made it to work or not?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

CodePirate7 avatar Feb 05 '20 20:02 CodePirate7

then what plugin you are using to achieve this?

nasr18 avatar Feb 06 '20 15:02 nasr18