#MongooseModule dependencies taking a humongous amount of time to initialize on 11.X

7 messages · Page 1 of 1 (latest)

quaint rune
#

Hi everyone! I have a production code base that i'm trying to port from 10.X to 11.X, but I'm having too much problem with the mongoose module....

Basically, on 10.X, the MongooseModule took around ~30ms to initilize with more than 40 modules loaded in the app.module. But, on 11.X, with only 5 modules, the MongooseModule took around 50 SECONDS to initialize.

I can't provide the code because of NDA's, so I don't expect any miracle solution, so I'm just asking around in order to find any reasonable explanation of why this could be happening.

Thanks in advance.

tulip jay
#

In main.ts, do

import mongoose from 'mongoose'

async function bootstrap(): Promise<void> {

// Whatever activation stuff you do

  mongoose.set("debug", true);
}

And check what the logs spit out

#

(I have nest 11 and mongoose, no such problem)

quaint rune
high wharf
#

Build your own mongoose module

#

Yeah, people will go over screw me, but Im going to provide PoC solution

#

In nest docs you have an example of how to provide an database module, let’s go forward and use it