This answer explains how to set up a firewall rule for port 27017 .
Another problem that can lead to this is running your mongodb on a separate network and having other instances on the network by default (or vice versa).
I came across this and, having received both instances on the same network, was able to connect to the mongo instance by name.
Here is an example of how to configure a network for a managed virtual machine in app.yaml :
network: instance_tag: https-server name: my-node-network
source share