I have a NodeJS server script with a bit of Socket.io, Express and Mongoose. Right now I have a stream query, the problem is that I want to change at some time the query.
Example:
var stream = Collection.find({date:{'$gt':currentTime}}).tailable().stream();
That works perfectly and send events to the: stream.on('data'); So that's cool.
But how I can change that query meanwhile is being streamed?
Thanks.
You can't. Basically you're asking for a way to change the query an existing cursor is bound to and that's not possible. You'd have to close your existing query stream and open a new one.