This repository contains materials for a presentation that delves into the relationship between Python and MongoDB.
-
Introduction to Python:
- Overview of Python programming language
- Key features and strengths of Python
- Python's popularity and use cases
-
Introduction to MongoDB:
- Overview of MongoDB database
- Key features and strengths of MongoDB
- MongoDB's popularity and use cases
-
Why Python and MongoDB?
- Compatibility between Python and MongoDB
- Advantages of using Python with MongoDB
- Real-world examples showcasing the synergy between the two technologies
-
Python Drivers for MongoDB:
- Overview of popular Python drivers for MongoDB (e.g., PyMongo)
- Installation and setup instructions
- Basic usage examples
# Basic usage example of PyMongo from pymongo import MongoClient # Connect to MongoDB client = MongoClient('mongodb://localhost:27017/') # Select database db = client['mydatabase'] # Select collection collection = db['mycollection'] # Insert document collection.insert_one({'key': 'value'}) # Find document result = collection.find_one({'key': 'value'}) # Print result print(result) # 5. CRUD Operations with Python and MongoDB: # Create - Inserting multiple documents collection.insert_many([ {'name': 'Imad', 'age': 19}, {'name': 'Najam', 'age': 25}, {'name': 'junior', 'age': 3} ]) # Read - Find documents results = collection.find({'age': {'$gte': 30}}) for result in results: print(result) # Update - Update a document collection.update_one({'name': 'Najam'}, {'$set': {'age': 32}})
collection.delete_one({'name': 'Alice'})