# Connecting from Node and Saving Documents

The official mongodb package connects Node to MongoDB with a MongoClient made from a connection string kept in .env, saves documents with insertOne and insertMany, reads them back with find().toArray(), and closes the client when the work is done.

![Cheat sheet: Connecting from Node and Saving Documents](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/1ba96af951ef47d5b7c27fabad021dd6.webp)

- Category: Node.js
- Level: Apprentice
- Tags: env-file, find (mongodb), insertOne and insertMany, MongoClient, mongodb, MongoDB Driver, nodejs
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/node-mongodb-connect-and-insert-cheat-sheet
