Mongo db 4.0 GPG key expired for ubuntu 18.04

GPG error: MongoDB Repositories bionic/mongodb-org/4.0 Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 68818C72E52529D4
E: The repository ‘MongoDB Repositories bionic/mongodb-org/4.0 Release’ is not signed.

MongoDB 4.0 is EoL software(April 2022), as well as Ubuntu 18.04(June 2023)

Looking at JIRA this is not something that MongoDB plans on fixing.

its happening in Ubuntu 20.04 also , and I am currently using mongodb 3.6 , i want to upgrade it to mongodb 5.0 , how can I do it then ??

The deb files can be downloaded directly from the release archive and they can be installed via dpkg -i

The other other workaround would be to explicitly trust the 4.0 repo, do this only on the 4.0 repo(or other unsupported / expired repo key) if you choose to use this option.

Add the trusted=yes option to the repo definition, read man 5 sources.list to understand this option and its implications.
echo "deb [ arch=amd64,arm64 trusted=yes ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.0.list