Skip to main content

DSL to MongoEngine Q.

Project description

Logo

Release Status

DSL to MongoEngine Q

Features

  • Build your mongoengine query from DSL syntax
  • Convert your data at build time via transform hook

Quickstart

Install

pip install mongoengine_dsl

Use

from mongoengine import Document, StringField
from mongoengine_dsl import Query


class User(Document):
    fullname = StringField()


User(fullname="Tom").save()
User(fullname="Dick").save()
User(fullname="Harry").save()

assert User.objects(
    Query("fullname: Dick")
).first().fullname == "Dick"

assert User.objects(
    Query("fullname: dick", transform={
        "fullname": lambda x: x.title()
    })
).first().fullname == "Dick"

More

Full Documentation: https://stonemoe.github.io/mongoengine_dsl

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

mongoengine_dsl-0.1.5.tar.gz (20.6 kB view hashes)

Uploaded Source

Built Distribution

mongoengine_dsl-0.1.5-py3-none-any.whl (21.4 kB view hashes)

Uploaded Python 3

Supported by

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