Mongosh docker

Using docker exec to run commands on a mongodb container

Connect

docker exec -it <container_name> mongosh -u <user_name> -p <password>

With -u an -p options being optional(obv).

Commands

show databases use <database_name> db.<collection_name>.find() # get all data in the collection db.<collection_name>.insertOne({ ... }) # insert data in the collection exit

Made with love by aayushmau5