adding connect guards for writing to mongo