In django, how to get the last instance of a query set if I use MongoEngine
Usually we perform
Users.objects.latest('id')
But I can not use latest in MongoEngine.
;). I am stuck.
I did not find a solution here. but I implemented. What do you think about below
Users.objects.all().order_by('-id').limit(1)[0]
This will return the last instance.
and also fixed the problem by passing it mongoenngine.
https://github.com/anishmenon/mongoengine/
You can install it and use
Users.objects.latest('id')
python django mongodb pymongo mongoengine
Anish menon
source share