1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2025-01-20 04:59:27 +02:00
dockerfiles/mongo/README.md

31 lines
709 B
Markdown
Raw Normal View History

2016-02-02 17:15:48 +08:00
mongo
=====
[MongoDB][1] is an open-source, document database designed for ease of development and scaling.
## up and running
```bash
2021-12-01 11:31:58 +08:00
$ pwgen -1 8 1
2016-02-02 17:15:48 +08:00
Aedahwa7
$ docker-compose up -d
2021-12-01 18:11:40 +08:00
$ docker-compose cp mongo:/usr/bin/mongo /usr/local/bin/
2016-02-02 17:15:48 +08:00
2021-12-01 11:31:58 +08:00
$ mongo mongodb://root:root@localhost:27017/admin
>>> use mydb
>>> db.createUser({user: 'myuser', pwd: 'Aedahwa7', roles: [{role: 'readWrite', db: 'mydb'}]})
>>> exit
2016-02-02 17:15:48 +08:00
$ mongo mongodb://myuser:Aedahwa7@localhost:27017/mydb
2021-12-01 11:31:58 +08:00
>>> show collections
>>> exit
2016-02-02 17:15:48 +08:00
```
2016-02-03 00:10:22 +08:00
Read [this][2] and [this][3] for more help.
2016-02-02 17:15:48 +08:00
[1]: https://www.mongodb.org/
[2]: https://docs.mongodb.org/manual/tutorial/enable-authentication/
2016-02-03 00:10:22 +08:00
[3]: https://docs.mongodb.org/manual/reference/built-in-roles/