nonexistentpath data directory /data/db not found

C++
# Create the folder
sudo mkdir -p /data/db/

# Set the ownership of the folder
sudo chown `id -u` /data/db
Source

Also in C++: