It does work but sometimes when server starts/restarts I get that error and get disconnected to db
[nodemon] starting `node server.js`
Server is running on port: 5000
(node:18433) UnhandledPromiseRejectionWarning: MongoNetworkError: connection 0 to crud-shard-00-02-2su4c.gcp.mongodb.net:27017 closed
at TLSSocket.<anonymous> (/home/root/Documents/crud/crud-test/backend/node_modules/mongodb/lib/core/connection/connection.js:352:9)
at Object.onceWrapper (events.js:286:20)
at TLSSocket.emit (events.js:198:13)
at _handle.close (net.js:606:12)
at TCP.done (_tls_wrap.js:388:7)
(node:18433) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:18433) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.