[#13] Implemented mongo conditional logic.