R
R
Roman2018-10-21 08:16:40
JavaScript
Roman, 2018-10-21 08:16:40

NodeJS + MongoDB. How to properly "close" client.close?

Actually there is a node, there is a mongodb module, there is a construction https://jsfiddle.net/x4f513gj/1/
In which part of the code is it more correct to use client.close() ? Thanks in advance for your reply.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2018-10-21
@Nc_Soft

Why close it at all? Connect once and that's it.

M
Michael, 2018-10-21
@mak_ufo

You do db.open() at startup and don't close the connection at all. This is the right approach

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question