NoSQL (MongoDB) is a free, non-relational database.
Note on MongoDB:
Click HERE for some useful Python files.
SQL | MongoDB |
---|---|
database | database |
table | collection |
row | document |
column | field |
index | index |
primary key any unique column or column combination |
primary key automatically set to _id field |
Build a MongoDB database of people and phone numbers using the mongo shell or Python.
For a full description of the problem and using the mongo shell, go HERE .
For a full description of the problem and using Python, go HERE .
Note: The mongo shell is an interactive JavaScript interface to MongoDB. You can use the mongo shell to query and update data as well as perform administrative operations.
{ <-- document first_name: "John", <-- string last_name: "Doe", <-- string age: 45, <-- number memberships: ['mem1","mem2"], <-- array address: { <-- object street: "44 Main St", city: "Los Angles", state: "California", zip_code:91001 }, contacts: [ <-- array of objects {name:"Brad", relationship:"friend"}, {name:"Carol",relationship:"boss"} ] }
There are free instances of MongoDB in the cloud. However, for this project, we will install MongoDB on a local machine. In particular, The workstation you are working on. (Linux Mint preferred.)
To install MongoDB
sudo apt install mongodb
To remove MongoDB
sudo apt remove mongodb sudo apt purge mongodb sudo apt autoremove
To make MongoDB a service
sudo systemctl status mongodb # MongoDB service status sudo systemctl start mongodb # start MongoDB service sudo systemctl stop mongodb # stop MongoDb service
orpython3 -m pip install pymongo
PyMongo module documentation can be found HERE.sudo pip3 install pymongo
The biggest piece of the puzzle that is missing is security. Who is allowed access? What can they do? Who is the database administrator?
The next biggest piece is secure network communications.