Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Documentation: https://pyodmongo.dev
Source Code: https://github.com/mauro-andre/pyodmongo
PyODMongo is a modern Python library that functions as a robust Object-Document Mapper (ODM) for MongoDB. Leveraging the power of Pydantic V2, it seamlessly bridges the gap between Python and MongoDB, offering an intuitive and efficient way to interact with MongoDB documents.
By using PyODMongo, you can effortlessly map your Python classes to MongoDB documents, allowing for a more Pythonic approach to handling data. This library simplifies the entire process of defining and working with MongoDB collections, documents, and queries.
PyODMongo is built on top of Pydantic V2, making the DbModel
class an extension of Pydantic's BaseModel
. This means that all the rich functionality of Pydantic's BaseModel
, including Validators, Fields and Model Config, is readily available in DbModel
.
Integration with pydantic: Leverage the power of pydantic's data validation and modeling capabilities while working with MongoDB data.
Automatic Schema Generation: Define your MongoDB schema using pydantic models, and pyodmongo
will automatically create the necessary MongoDB collections and ensure data consistency.
Query Builder: Easily construct complex MongoDB queries using Python code, reducing the need for writing raw query strings.
Document Serialization: Serialize and deserialize Python objects to and from MongoDB documents effortlessly.
Async Support: Take advantage of asynchronous programming with pyodmongo
to enhance the performance of your MongoDB operations.
Active Development: pyodmongo
is actively developed and maintained, with new features and improvements being regularly added.
You can install pyodmongo
using pip:
pip install pyodmongo
Contributions to pyodmongo
are welcome! If you find any issues or have ideas for improvements, please open an issue or submit a pull request on the GitHub repository.
pyodmongo
is licensed under the MIT License. See the LICENSE file for more information.
from pyodmongo import AsyncDbEngine, DbModel
from typing import ClassVar
import asyncio
engine = AsyncDbEngine(mongo_uri='mongodb://localhost:27017', db_name='my_db')
class Product(DbModel):
name: str
price: float
is_available: bool
_collection: ClassVar = 'products'
box = Product(name='Box', price='5.99', is_available=True)
async def main():
result = await engine.save(box)
asyncio.run(main())
from pyodmongo import DbEngine, DbModel
from typing import ClassVar
engine = DbEngine(mongo_uri='mongodb://localhost:27017', db_name='my_db')
class Product(DbModel):
name: str
price: float
is_available: bool
_collection: ClassVar = 'products'
box = Product(name='Box', price='5.99', is_available=True)
result = engine.save(box)
FAQs
A syncrounous and asyncrounous Python ODM for MongoDB based on Pydantic
We found that pyodmongo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.