Skip to content

A basic contact-list with Python and MongoDB that does the CRUD operations on a contact-list.

Notifications You must be signed in to change notification settings

amirkhgraphic/Pymongo-contact-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contact List (MongoDB/CLI) 🌐

Description 📑

this project is consist of 2 main parts; first we have the models.py file, where the collection's schema is. then, we have the main.py which has the responsibility to do the CRUD operations on the database.

Notice: I have commented codes related to logger because It was more of a distraction due to the fact that it logs the the information in the terminal where the output of the command also exists! but you can uncomment it based on your desire :)

APOLOGY! I wanted to use MongoDB-Atlas to deploy the database... I did it but I couldn't insert any data :( now you need to run a MongoDB instanse on your localhost port 27017 (which is the default port of it). alternative way, you can modify the connection_string to connect to your own MongoDB database (it will create the database and collection automatically)

How to Run ❓

first you need to create a virtual environment, cd to the directory where this file is and then run the following command:

Create and Activate a Virtual Environment:

  • Linux/mac:
$ pip install virtualenv
$ virtualenv [YourVenvName]
$ source [YourVenvName]/bin/activate
  • Windows:
pip install virtualenv
python -m venv [YourVenvName]
[YourVenvName]/Scripts/activate

install the required libraries and run the code:

$ pip install -r requirements.txt

execute READ operation:

$ python main.py list

or if you want to search for a specific contact:

$ python main.py search -f <first name> -l <last name>

execute CREATE operation:

$ python main.py create -f <first name> -l <last name> -d <country code> -n <phone number> [-C <country>] [-c <city>] [-a <address>]

execute UPDATE operation:

$ python main.py create -f <first name> -l <last name> [-d <new country code>] [-n <new phone number>] [-C <new country>] [-c <new city>] [-a <new address>] [-F <new first name>] [-L <new last name>]

execute DELETE operation:

$ python main.py delete -f <first name> -l <last name>

Contribute! 🤝🏻

I'm more than happy to hear your feedbacks and collaborate with you guys!

if you had any problem contributing on the project, feel free to contact me:

- Amirhoseein Khalili

About

A basic contact-list with Python and MongoDB that does the CRUD operations on a contact-list.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages