- Build the container
docker run --name some-mongo -v $PWD/data:/data/db -p 27017:27017 -d mongo
- import data
mongoimport --db students students.json
- build with docker exec to allow commands inside of the container
docker exec -it some-mongo mongo
- complete the assignment
grab configuration from the cluster
- Import into Datagrip
from + icon from the connection list
mongo - starts the mongo shell
show dbs - lists all dbs in the mongo shell
use <db name> - switches to the db in question
Collections
db.shipment.createIndex({name: 1, street: 1, zip:1}) - creates a collection of shipments with name, street, and zip, attributes in ascending order
db.<collection>.getIndexes() - returns the number of items in the collection
db.<collection>.find() - lists all indexes/entries in a collection
db.<collection>.aggregate({}) allows for nested queries and aggregate pipeline queries using $count, $match, $group etc.