How did I fix «Detected data files in /var/lib/mongodb created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'»?

STORAGE [initandlisten] Detected data files in /var/lib/mongodb created by the ‘mmapv1’ storage engine, so setting the active storage engine to ‘mmapv1’

I had an old MongoDB version installed previously, and it left some data in the /var/lib/mongodb folder.
So, I fixed the issue by deleting the /var/lib/mongodb folder and then re-installing MongoDB.