MongoDB - How to retrieve latest document from collection in robot framework with recordJson

Hi,

I’m using MongoDBLibrary and i would like to retrieve the latest document inserted from a collection.
i have python code that can get it -
def retrieveLatestDocument(mongoConnection, dbName, collectioName):
myclient = pymongo.MongoClient(mongoConnection)
mydb = myclient[dbName]
mycol = mydb[collectioName]
mydoc = mycol.find().sort("_id",-1).limit(1)
myclient.close
return mydoc

i would like to perform it on robot framework.

i tried to use the-
https://robotframework-thailand.github.io/robotframework-mongodb-library/MongoDBLibrary.html

MongoDBLibrary.Retrieve Mongodb Records With Desired Fields BUT could not find the right ‘recordJSON’ to get the latest document from collection

is there a way to do it in robot framework?

Thanks, Moshe