How to connect multiple database in mongodb/node js using mongoose

How to connect multiple database in mongodb/node js using mongoose

Hari the decoder

1 год назад

8,499 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@salmanhossain1637
@salmanhossain1637 - 14.02.2024 12:49

thanks bro

Ответить
@sonnguyendang7247
@sonnguyendang7247 - 25.12.2023 14:00

I tried this method of your to create connection successfully. However, I got an issue that is when the first time the app initiate connections, if somehow the internet get disconnected or link to database is down(database is not local), therefore the app fail to initiate the instance so that the whole app crash because it can not use the .model() of failed connection. If anyone has any idea or work around about this problem, please let me know.

Ответить
@IurySantos-np7vs
@IurySantos-np7vs - 01.07.2023 22:50

Could you please post the code itself in the description(or upload it in a link)? It should take just a moment and would help me a lot.

Ответить
@jamesc6777
@jamesc6777 - 26.03.2023 00:36

How do you reference the db1 and db2 if the Models and routes are defined in different files? Lmk If i can clarify my question better.

Ответить
@Mohamed_developer_
@Mohamed_developer_ - 21.03.2023 05:11

Nice

Ответить
@spreadItWide
@spreadItWide - 08.01.2023 18:09

Can you still reference other objects that are in different DB's?

ex:
Name: {name: String}
Email: {email: String, user_id: { type: Schema.Types.ObjectId, ref: 'Name'}}

Ответить
@ivanananiev6618
@ivanananiev6618 - 11.12.2022 03:22

Thank you!

Ответить