SlingAcademy

Python

PyMongo: how to search documents by ObjectId

Updated: Feb 08, 2024

Overview In this tutorial, we will dive into how to effectively search for documents in MongoDB using PyMongo by leveraging ObjectId. Whether you are a beginner or have previous experience with MongoDB, this guide will provide insights......

PyMongo: How to simulate ‘LIKE’ and ‘ILIKE’ in SQL

Updated: Feb 08, 2024

Introduction In the realm of database management, querying data efficiently and effectively is paramount. While SQL databases offer ‘LIKE’ and ‘ILIKE’ operators for pattern-based searching, MongoDB, a NoSQL......

PyMongo: How to insert and update JSON data

Updated: Feb 08, 2024

Introduction Working with MongoDB through Python requires an efficient and effective tool, and PyMongo stands out as a flagship library in this domain. PyMongo is a Python distribution containing tools for working with MongoDB,......

PyMongo: Saving and Querying Location Data (Latitude, Longitude)

Updated: Feb 08, 2024

Introduction Managing geospatial data efficiently in MongoDB with PyMongo can elevate the functionality of location-based services, making it essential for developers to understand the intricacies of saving and querying location data.......

PyMongo: Grouping documents by day/month/year

Updated: Feb 08, 2024

Overview Understanding how to effectively group documents by day, month, or year with PyMongo can significantly enhance your ability to analyze time-series data or perform aggregations based on temporal attributes. In MongoDB, the......

PyMongo: How to save datetime with timezone

Updated: Feb 08, 2024

Overview Saving dates and times in a MongoDB database using PyMongo is a common task for many developers. However, dealing with timezones can add complexity to this seemingly simple task. This tutorial will guide you through the......

PyMongo: Query and update documents based on nested fields

Updated: Feb 08, 2024

Overview MongoDB is a powerful NoSQL database widely used for its flexibility, performance, and scalability. Working with MongoDB from Python is made easier with the PyMongo library, which allows Python applications to connect to......

PyMongo: How to select/count distinct documents

Updated: Feb 08, 2024

Overview In this tutorial, we will delve deep into using PyMongo, a Python distribution containing tools for working with MongoDB. Our focus will be on how to select and count distinct documents within a collection. MongoDB, a NoSQL......

How to translate MongoDB shell syntax to PyMongo code

Updated: Feb 08, 2024

Overview Working with MongoDB through its shell is a swift way to perform database operations. However, when it comes to integrating these operations into a Python application, PyMongo comes into play. PyMongo is a Python distribution......

PyMongo: How to update and delete documents

Updated: Feb 08, 2024

Introduction PyMongo is a Python distribution containing tools for working with MongoDB, and is the recommended way to work with MongoDB from Python. This tutorial will focus on how to update and delete documents in a MongoDB database......

Python: Using PyMongo with Type Hints

Updated: Feb 08, 2024

Introduction Recent versions of Python introduce several improvements that make development faster, more efficient, and easier to understand. One of the notable areas where Python has been making consistent advancements is in type......