adds extra check in mongoController to handle undefined data