title: running mongoexport from inside one container to another within a docker-compose stack
body: <p>I'm building a CMS that needs to export mongodb data in json format and return it as a .zip file to an api request. </p>
  
  <p>I have a service called "web" and I'm needing to run </p>
  
  <pre><code>const child = exec(`mongoexport --db meanbase --collection pages --out ${path.join(this.app.get('exportPath'), 'pages.json')} --jsonArray`)
  </code></pre>
  
  <p>However it returns code 127 - command not found. This is because my mongoDB service is running inside another container.</p>
  
  <pre><code>db:
    image: mongo
    expose:
      - "27017"
      - "37017"
    command: --smallfiles
  web:
    build: .
    expose:
      - "80"
    env_file:
      - meanbase.env
    links:
        - db:db
  nginx:
    build: nginx
    links:
      - web:web
    volumes_from:
      - web
    ports:
      - "80:80"
  </code></pre>
  
  <p>How do I run mongoexport from my web container for the db container and get it's content delivered back to the the web container? Or is there a better way to be doing this?</p>