As of Ubuntu 20.04, php-mongodb in the database is outdated and you'll need the PECL method to install latest version of MongoDB.
To do this in Ubuntu, you'll need the php-pear plugin and php-dev:
sudo apt install php-dev php-pear
then you can run:
sudo pecl install mongodb