# Connecting from Node: MongoClient and the Connection String

The official mongodb package connects a Node app to MongoDB through a MongoClient made from a connection string, which lives in a .env file that Node reads with --env-file, and the app connects that one client when it starts and closes it when it stops.

![Cheat sheet: Connecting from Node: MongoClient and the Connection String](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/2ec6e414d7b34448a5516e7bcda61846.webp)

- Category: MongoDB
- Level: Journeyman
- Tags: Connection String (mongodb), env-file, MongoClient, mongodb, MongoDB Driver, nodejs, process.env
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/mongodb-driver-connecting-from-node-cheat-sheet
