How I can use sort function in findOne() function?

An alternative is probably using

db.collection.find(filter).sort(xxx).limit(1)

1 Like