error: Unit mongodb.service is masked when starting mongodb

Solution 1:

Unit mongodb.service is masked.

So unmask it:

sudo systemctl unmask mongodb

Why are some systemd services in the "masked" state? explains masking.

Solution 2:

With 3+ version of mongodb. You dont have to start mongodb but you just have to start mongod. So proper way to start mongod will be

sudo systemctl start mongod