Cannot connect to MongoDb client

I am not being able to connect to MongoDB.
The error i am getting is

 |         options.includeResultMetadata ??= false;
20:46:01 0|app    |                                       ^^^
20:46:01 0|app    | SyntaxError: Unexpected token '??='

Node version when i am running the project is
node -v => v20.7.0

MongoDB version
mongod –version => db version v6.0.8

package.json

"dependencies": {
    "compression": "^1.7.4",
    "cors": "^2.8.5",
    "express": "^4.18.2",
    "helmet": "^7.0.0",
    "http-status": "^1.7.0",
    "mongodb": "^6.1.0",
    "xss-clean": "^0.1.4"
  }
}

What am i missing

The code

const { MongoClient } = require('mongodb');


const uri = 'mongodb://localhost/testDatabase';

const client = new MongoClient(uri, {
  useNewUrlParser: true,
  useUnifiedTopology: true,
});

async function connectToDatabase() {
  try {
    await client.connect();
    console.log('Connected to the MongoDB database');
  } catch (err) {
    console.error('Error connecting to the MongoDB database:', err);
  }
}

module.exports = {
  connectToDatabase,
  getDatabase: () => client.db(),
};