We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class Foo(Document): a_str = StringField() a_list_str = ListField(StringField()) foo = Foo(a_str='a', a_list_str=['1','2','3']) foo.save() foo.a_list_str[-1] = '4' foo.save() foo = Foo.objects(a_str='a').as_pymongo().first() print foo['a_list_str'][-1]
=> ['1', '2', '4'] The last element becomes list itself
The bug is in file mongoengine/base/document at line 644:
if isinstance(d, list) and p.isdigit():
It should be:
if isinstance(d, list) and p.lstrip('-').isdigit():
The text was updated successfully, but these errors were encountered:
Fixed: ListField minus index assignment does not work MongoEngine#1119
5bbfca4
Add code to detect '-1' as a integer. Normalize negative index to regular list index Added list assignment test case
updated changelog.rst for MongoEngine#1119
2ae2bfd
Merge pull request #1128 from iici-gli/master
05e40e5
Fixed: ListField minus index assignment does not work #1119
e8ea294
This issue was fixed by #1435. I added an extra test for this behavior in e8ea294.
Sorry, something went wrong.
No branches or pull requests
=> ['1', '2', '4']
The last element becomes list itself
The bug is in file mongoengine/base/document at line 644:
It should be:
The text was updated successfully, but these errors were encountered: