Tags

,

Assume that your mongo container is already started.

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                               NAMES
33f829af4ee1        87bde25ffc68        "/entrypoint.sh mong…"   13 months ago       Up 4 minutes        0.0.0.0:27017->27017/tcp            mongo
...
$ docker exec -it mongo bash
root@33f829af4ee1:/# mongo
...
> show databases
local             0.000GB
mongoid_app_dev   0.000GB
...
> use mongoid_app_dev   
switched to db mongoid_app_dev
...
> show collections ## SHOW tables;
articles
...
> db.articles.find()
{ "_id" : ObjectId("5cf681bd8f8f583758a1203f"), "title" : "hello", "content" : "blah blah blah" }
...
> Object.keys(db.articles.findOne()) ## DESCRIBE `tablename`
...

References:
https://docs.mongodb.com/manual/mongo/
https://docs.mongodb.com/mongoid/current/