reading files from mongodb and replace html template with data