Skip to content

Update of field called size #244

Description

@blackvladimir

When I do

cls.update('set_size' = 10)

I get

File "/usr/lib/python2.7/site-packages/mongoengine/document.py", line 327, in update
    return self.__class__.objects(**self._object_key).update_one(**kwargs)
File "/usr/lib/python2.7/site-packages/mongoengine/queryset.py", line 1563, in update_one
    update = QuerySet._transform_update(self._document, **update)
File "/usr/lib/python2.7/site-packages/mongoengine/queryset.py", line 1465, in _transform_update        
    field = cleaned_fields[-1]

It looks like the problem occurs when the field name is also match operator name (queryset.py:1416). I don't know your code so I don't dare to send patch but I think it can be solved by checking of length of parts variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions