I want to extract last objectID of a document from a collection in python and want to store it in python object.
I am doing something like this
db.dataset2.find().sort( {'_id': -1 } ).limit(1);
But it gives me an error.
TypeError: if no direction is specified, key_or_list must be an instance of the list
Please help.