January 17th, 2024 Docker MongoDB – csv import Ref: https://www.mongodb.com/developer/products/mongodb/mongoimport-guide/ # Docker compose for mongodb. # Create a volume to place the csv file in it version: "2.0" services: mongodb: image: mongo:4.4.2 restart: always mem_limit: 512m volumes: - ./mongodata:/data/db ports: - "27019:27017" command: mongod # environment: # - MONGO_INITDB_ROOT_USERNAME=root # - MONGO_INITDB_ROOT_PASSWORD=password healthcheck: test: "mongo --eval 'db.stats().ok'" interval: 5s timeout: 2s retries: 60 # Connect to mongodb docker container docker exec -it 79e80b878fbc bash root@ > mongoimport \ --collection='fields_option' \ --file=/data/db/events.csv \ --type=csv \ --fields="timestamp","visitorid","event","itemid","transactionid" Leave a Reply Cancel replyYour email address will not be published. Required fields are marked *Comment * Name * Email * Website Save my name, email, and website in this browser for the next time I comment.
Leave a Reply