C
C
Coder3212016-12-11 23:43:39
JavaScript
Coder321, 2016-12-11 23:43:39

How to properly connect to mongo?

How to connect to mongo correctly, once at the start of the application, or each time with a separate request to the database?
And another question, how to use async await when making requests to mongo?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton L, 2016-12-12
@Coder321

1. Once at the start of the application.
2. All native driver methods (mongodb package in npm) return a promise. Write await before each method.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question