Update template.c

Check if Mongndb is enable/supported to avoid compile error if mongo.h is not available