Check out example codes for "how to import docker mongo data to local mongodb". It will help you in understanding the concepts better.

Code Example 1

docker-compose exec -T <name_of_mongodb_container> mongorestore --archive --gzip < dump.gz

Code Example 2

version: '3'
services:
  mongodb:
    image: mongo:3.2.6
    ports:
      - 27017:27017

  mongo_seed:
    image: mongo:3.2.6
    links:
      - mongodb
    volumes:
      - ./mongo-seed:/mongo-seed
    command:
      /mongo-seed/import.sh

Code Example 3

#! /bin/bash

mongoimport --host mongodb --db test --collection census --type json --file /mongo-seed/census.json --jsonArray

Learn ReactJs, React Native from akashmittal.com