-
Type: Question
-
Resolution: Works as Designed
-
Priority: Unknown
-
None
-
Affects Version/s: 5.2.0
-
Component/s: TypeScript
When trying to connect to my Atlas database in a Node project that I set up using Vite, I get the error in the attached screenshot. Since Vite does not allow "require" statements out of the box, I changed the import to "import { MongoClient, ServerApiVersion } from "mongodb";".
I have tried this on both Node v16.19.0 and v18.15.0 and get the same result. I tried to connect using the code sample provided by Atlas, as well as the code samples provided in the documentation [here|https://www.mongodb.com/docs/drivers/node/current/quick-start/connect-to-mongodb/|https://www.mongodb.com/docs/drivers/node/current/quick-start/connect-to-mongodb/].] and here
- is related to
-
NODE-5209 Receiving TypeError every time connect method is called
- Closed