You can retrieve the last record in MongoDB by sorting your collection in descending order and then limiting the result to 1.
Here is an example in MongoDB shell:
```
db.collection.find().sort({_id:-1}).limit(1)
```
In this example, ‘collection’ is the name of the collection where the data is stored.
This works because MongoDB assigns unique ObjectIds to each document which are generated considering the timestamp, this way the latest document would have the highest \_id.
Sorting in descending order (`-1`) returns documents in the reverse order they were inserted, i.e., the latest document first. And `limit(1)` returns only one document, which would be the latest one.
Just make sure you have an index on the field being sorted on (`db.collection.createIndex({_id: -1})`), otherwise sorting could be slow on large collections.