You could create both containers on the same overlay network. Then the app container could talk with MongoDB. See docker connect a service to the overlay network.
Another thing you need to consider is MongoDB data persistence. When MongoDB container moves to another node, it should be able to read the existing data, or else, data will get lost. Also you will want a MongoDB ReplicaSet or Sharded cluster to better protect your data. You may refer to the discussions in the question: Data(base) persistence in docker swarm mode.