# From mongosh to the Driver: find, insertOne and toArray

Every mongosh query has a twin in the Node.js driver, written with db.collection("pets"), await, a projection inside an options object, toArray() to read a cursor, and new ObjectId(id) imported from the driver, and insertOne gives back the new document's insertedId.

![Cheat sheet: From mongosh to the Driver: find, insertOne and toArray](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/6d318591c69f4842a93ad3a8c4f47cd2.webp)

- Category: MongoDB
- Level: Journeyman
- Tags: \_id and ObjectId, Cursor (mongodb), find (mongodb), insertOne and insertMany, mongodb, nodejs
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/mongodb-driver-from-mongosh-to-the-driver-cheat-sheet
