Skip to content

Latest commit

 

History

History
57 lines (37 loc) · 972 Bytes

README.md

File metadata and controls

57 lines (37 loc) · 972 Bytes

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