Skip to main content

Magic filters for MongoDB

Project description

MongoForge

Magic filters for MongoDB

Installation

pip install mongoforge

Basic example

from pymongo import MongoClient
from mongoforge import F

cluster = MongoClient(...)
collection = cluster.db.users

if user := collection.find_one(F._id == 1): # {"_id": 1}
    print(user)
else:
    collection.insert_one(...)

Available filters

MongoDB Operator Python Expression Example Output
$eq F.age == 21 {"age": 21}
$gt F.age > 21 {"age": {"$gt": 21}}
$lt F.age < 21 {"age": {"$lt": 21}}
$gte F.age >= 21 {"age": {"$gte": 21}}
$lte F.age <= 21 {"age": {"$lte": 21}}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mongoforge-1.0.0.tar.gz (1.8 kB view details)

Uploaded Source

File details

Details for the file mongoforge-1.0.0.tar.gz.

File metadata

  • Download URL: mongoforge-1.0.0.tar.gz
  • Upload date:
  • Size: 1.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for mongoforge-1.0.0.tar.gz
Algorithm Hash digest
SHA256 334980396ea0e53cef7d4e1bd4fce9f3be73d0c48d06886bc4c6a2b839ce04d5
MD5 9568d2ab88dded48e5f72e1c82aecbf8
BLAKE2b-256 5c9a538836e2fc818deb4d4db7a2329b3ca3df6015575b82a6fe7230ffe5a8fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page