in searching on this topic I found use cases combining the skip(), sort() and count() methods with the find(), as well as aggregation.
What I would like to know is with a large dataset, which method is most efficient in retrieving the last record, especially when it needs to be done often.
What does your data look like? What’s the field that determines the “last” record? Last inserted or last by time field? What indexes do you have?
If inserting via the driver, the driver can generate the _id field so if you have multiple processes on different machines inserting data then the _id may not guarantee insertion order over all data depending on OS Clocks.
As a very basic, if you had one process inserting data then sorting by ID desc and pulling one record could result in making use of the auto-generated index on _id and be a very quick lookup: