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

STORAGE [initandlisten] exception in initAndListen: Location18656: Cannot start server with an unknown storage engine: mmapv1, terminating

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