Skip to content

Instantly share code, notes, and snippets.

@aayushmau5
Created April 9, 2022 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aayushmau5/d21d59788915a1fa8278ff7463830efd to your computer and use it in GitHub Desktop.
Save aayushmau5/d21d59788915a1fa8278ff7463830efd to your computer and use it in GitHub Desktop.

Mongosh in Docker

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment