Skip to content

What happen if I try to find a document while database connection is not fully ready ? #14907

Closed Answered by vkarpov15
Apokalypt asked this question in Q&A
Discussion options

You must be logged in to vote

Presuming you already called mongoose.connect(), the MongoDB node driver will automatically retry any queries for up to serverSelectionTimeoutMS (30 seconds by default). So your find() call will wait until mongoose.connect() succeeds up to a certain timeout. If it takes more than 30 seconds to connect, your find() will error out

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Apokalypt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants