Kuberenetes ClusterIP service not working

I am deploying a mongo express pod which talks to mong db pod via internal service (clusterIP). But, when the express pod run it never connects via the service name to mongo db POD . But the same works fine when I mentioned the private IP in the db url instead of service name

Kubernetes version:
Cloud being used: GCP
Client Version: v1.28.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.28.4
Host OS : Ubuntu LTS

Installed the kubernetes on GCP Linux instance (master and 2 worker node)