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
Use sort and limit, if you want to use cursor :
var last = null; var findCursor = collection.find({}).cursor(); findCursor.on("data", function(data) { last = data; ... }); findCursor.on("end", function(data) { // last result in last .... });