Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get first object in mongoengine

I have a class with name of Request and I want to get first object of it in mongoengine I think I can use this :
first get all objects like this
visitors = Request.objects.all()
and then
ss = visitors[0].ip
and then call an attribute of object

like image 937
MDK Avatar asked Oct 16 '25 09:10

MDK


1 Answers

It's simple just use : Request.objects.first()

like image 200
MDK Avatar answered Oct 19 '25 00:10

MDK