How to find the maximum value of a document field with Python and MongoDB?
I am trying to find a document in a MongoDB instance with the largest value of a particular field. Here is the current code I have to do that: document = collection.find().sort('experiment_id', -1).limit(1) if document is None: # ... else:…