How did I fix «Cannot start server with an unknown storage engine: mmapv1» for MongoDB?

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’»?