I have the following use case:
- A NodeJS (nest) app that uses typeorm for MongoDB
- A separate (forked) process using nestjs/bull that is created based on some event that does some processing.
Within the separate process, I need to do some tasks and then connect via Typeorm to Mongodb to update state based on those tasks. However, since it is a separate process, doing getConnection
with TypeORM does not work - in the sense that, if I have created any connections in the parent process, I cannot access them in this separate process. I assume because, as it is a separate process, it does not share any of the memory from the parent process (unless things like connections are explicitly copied over? not sure).
I am wondering if there is a way around this? Or would I just need to manage connections within this separate process? Any recommendations on how to do that without overloading the DB with just a bunch of standalone connections being created?
Thank you.