Git Product home page Git Product logo

mongodb-docker-compose's Introduction

Docker Compose MongoDB for Developer

Run Docker Compose

build images

$ docker-compose -f docker-compose.yml build --force-rm

run

$ docker-compose -f docker-compose.yml up

docker exec

$ docker exec -it mongodb_mongodb_container_1 bash

MongoDB credential (for database admin)

  • Username: root
  • Password: rootpassword

How to connect to MongoDB

Via mongo Shell

Type this

$ mongo admin -u root -p rootpassword

It will connect to localhost port 27017.

Note that mongo command should be installed on the computer. On Linux this should be install mongodb-org-shell only. Refer to this for more detail https://docs.mongodb.com/manual/installation/

Some quick tips after logged-in

Show databases:

$ show dbs

Create new non-existant database:

$ use mydatabase

Show collections:

$ show collections

Show contents of a collection:

$ db.your_collection_name.find()

Save a data to a collection:

$ db.your_collection_name.save({"name":"Sony AK"})

Show database version:

$ db.version()

Enjoy your local MongoDB database server for any purpose you want, for me this setup is fine for testing purpose.

mongodb-docker-compose's People

Watchers

Chalermporn Posoppitakwong avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.