MongoEngine/mongoengine

slice on dict field containing list does'nt work

Opened this issue · 0 comments

pymongo: 3.12.0
mongoengine: 0.23.1

I have a document:

class Logs(Document):
    reference_id = StringField(default=None)
    data = DictField(default=None)

In data field, i have a list failed_stories. This can have hundreds of elements and I want to perform pagination on it. So, i write this query as:

start_idx = 0
page_size = 10
reference_id = 'asdfg345678'
Logs.objects(reference_id=reference_id).fields(slice__data__failed_stories=[start_idx, page_size])

With this, i get one document in which all field are None except the dociment id (_id).

The following query results in document with correct data in document fields.
Logs.objects(reference_id=reference_id).get()

Is there any issue with the way I am writing this?