Property 'connect' does not exist on type 'typeof import
I have problem when I try to use mongodb.connect() func..
import mongodb from "mongodb"
import dotenv from "dotenv"
dotenv.config()
mongodb.connect()
Then error appears " Property 'connect' does not exist on type 'typeof import(..)
To create a connection to mongodb, you should first import the MongoClient, then you need to create a instance of the client, and only through the instance you will be able to create the connection.
See the example bellow taken from mongodb package documentation in npm
import { MongoClient } from 'mongodb'
const url = 'mongodb://localhost:27017';
const client = new MongoClient(url);
await client.connect();
Check this out for more details.