$ docker pull mongo:latest
$ sudo mkdir -p /opt/mongodb/db
$ docker run -p 27017:27017 -v /opt/mongodb/db:/data/db --name my-mongo-dev -d mongo mongod --auth
$ docker ps
$ docker logs -f my-mongo-dev
$ docker exec -it my-mongo-dev mongo
use admin
db.createUser(
{
user: "siteUserAdmin",
pwd: "unPasswordQuiVaBien",
roles: [{role: "userAdminAnyDatabase", db: "admin"}]
}
)
$ mongo -p 27017 -u siteUserAdmin --authenticationDatabase admin
use kanban
db.createUser(
{
user: "kanbanUser",
pwd: "unAutrePasswordQuiVaBien",
roles: ["dbOwner"]
}
)
$ mongo --port 27017 -u kanbanUser -p kanban --authenticationDatabase kanban
http://api.mongodb.com/python/current/tutorial.html
from pymongo import MongoClient
client = MongoClient(
'mongodb://{user}:{passwd}@{host}:{port}/kanban'.format(
host='127.0.0.1',
port=27017
user='kanbanUser',
passwd='unAutrePasswordQuiVaBien',
)
)
db = client.kanban
kanban = db.kanban
for cur in kanban.find():
print(cur)
urls:
- https://www.tutorialspoint.com/mongodb/mongodb_advantages.htm
- http://pierrepironin.fr/docker-et-mongodb/
- https://hub.docker.com/_/mongo/
- https://stackoverflow.com/questions/9146123/pretty-print-in-mongodb-shell-as-default
- http://en.proft.me/2015/12/25/extend-and-colorize-mongodb-shell/
- http://api.mongodb.com/python/current/api/pymongo/database.html#pymongo.database.Database.drop_collection
- https://stackoverflow.com/questions/9805451/how-to-find-names-of-all-collections-using-pymongo
- https://docs.mongodb.com/getting-started/python/remove/
- http://api.mongodb.com/python/current/examples/authentication.html?highlight=password
- http://www.mongoalchemy.org/
- https://docs.mongodb.com/ecosystem/drivers/python/
- https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/#install-mongodb-community-edition