BlogPost.objects(id=post.id).update_one(push__tags='nosql')
I want to prepend instead of appending, is there a way ?
Another alternate question to the same problem ..
I can query in a list by position like this
BlogPost.objects(tags__0='nosql')
Is there a way to specify the last element in the list, like -1 index
in python lists ?
BlogPost.objects(tags__-1='nosql') # ?.. I wish !
Answers to any of two question will solve my problem.
and this is a link to this question on Stackoverflow
http://stackoverflow.com/questions/8326208/how-to-prepend-an-element-to-a-list-in-mongoengine
Thanks in advance.
- Dan