mongoose.connect not a function type error

I am running a database connection to mongoDB using mongoose(v 8.6.2) in next.js and it keeps throwing an error of .connect not being a function, this is my database.js file

import mongoose from 'mongoose';


let isConnected = false; // track the connection

export const connectToDB = async () => {
  

  if(isConnected) {
    console.log('MongoDB is already connected');
    return;
  }

  try {
    await mongoose.connect(process.env.MONGODB_URI, {
      dbName: "share_prompt",
      useNewUrlParser: true,
      useUnifiedTopology: true,
      strictQuery: true
    })

    isConnected = true;

    console.log('MongoDB connected')
  } catch (error) {
    console.log(error);
  }
}

I’ve tried checking mongoose documentation to see if there’s any new syntax for .connect, but I’ve gotten nothing