Projections#

Note

PROJECTION, SHOW and HIDE are still exported for backwards compatibility reasons.

All of these classes are importable from alaric.projections

Projection#

class alaric.projections.Projection(*fields: Show | Hide)#

Specify that only the given fields should be returned from the query.

1# Assuming the data structure
2# {"_id": 1234, "prefix": "!", "has_premium": False}
3data: dict = await Document.find(
4    {"_id": "my_id"}, projections=Projection(Show("prefix"))
5)
6print(data)
7# Will print {"prefix": "!"}
build() Dict#

Show#

class alaric.projections.Show(*fields: Any)#

Show this field in the returned data.

build() Dict#

Hide#

class alaric.projections.Hide(*fields: Any)#

Hide this field in the returned data.

build() Dict#