2016-02-02 11:15:48 +02:00
|
|
|
mongo
|
|
|
|
=====
|
|
|
|
|
|
|
|
[MongoDB][1] is an open-source, document database designed for ease of development and scaling.
|
|
|
|
|
|
|
|
## up and running
|
|
|
|
|
|
|
|
```bash
|
2021-12-01 05:31:58 +02:00
|
|
|
$ pwgen -1 8 1
|
2016-02-02 11:15:48 +02:00
|
|
|
Aedahwa7
|
|
|
|
|
|
|
|
$ docker-compose up -d
|
|
|
|
|
2021-12-01 12:11:40 +02:00
|
|
|
$ docker-compose cp mongo:/usr/bin/mongo /usr/local/bin/
|
2016-02-02 11:15:48 +02:00
|
|
|
|
2021-12-01 05:31:58 +02: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 11:15:48 +02:00
|
|
|
|
|
|
|
$ mongo mongodb://myuser:Aedahwa7@localhost:27017/mydb
|
2021-12-01 05:31:58 +02:00
|
|
|
>>> show collections
|
|
|
|
>>> exit
|
2016-02-02 11:15:48 +02:00
|
|
|
```
|
|
|
|
|
2016-02-02 18:10:22 +02:00
|
|
|
Read [this][2] and [this][3] for more help.
|
2016-02-02 11:15:48 +02:00
|
|
|
|
|
|
|
[1]: https://www.mongodb.org/
|
|
|
|
[2]: https://docs.mongodb.org/manual/tutorial/enable-authentication/
|
2016-02-02 18:10:22 +02:00
|
|
|
[3]: https://docs.mongodb.org/manual/reference/built-in-roles/
|