I agree with Kieren's suggestion, per my experience and use cases in a sharded environment with heavy writes.
I did try this via the shell though for a simple test colleciton of a few users in a standalone instance of MongoDB. I just projected the _id in the results and sorted the results in DESC order and then limited the results to 1.
db.users.find({},{ _id: 1 }).sort({_id:-1}).limit(1);
I'd test that out though. It seems too easy.
In my sharded cluster use case, the problem is not MongoDB retrieving
the last id but instead is the last id the actual id I desire\expect. It
may likely be the _id for a different object you were not expecting. So
pending what your use case is, just ensure the last _id you retrieve is for the object you expect it to be for.