I\'m trying to \'stream\' data from a node.js/MongoDB instance to the client using websockets. It is all working well.
But how to I identify the last document in t
Say I have companies collection. Below snippet gives me last document in the collection.
db.companies.find({},{"_id":1}).skip(db.companies.find().count()-1);
Code cannot rely on _id as it may not be on a specific pattern always if it's a user defined value.