Couchbase view is returning older data even after querying with stale set to false

Hi all , my view is as following,

function (doc, meta) {

if(doc._type=='couponGame') {

    var today = new Date().toJSON().slice(0,10);

    var gameDate = new Date(doc.createdat).toJSON().slice(0,10);

  if(gameDate == today)



lets say it was working fine yesterday, but today also it is giving yesterday’s result only.even after stale set to false. it starts working fine if force indexing manually by publishing the entire design doc. is it possible that the variable today is calculated only once when the view is published?

Thanks .

With stale=false, you should be able to get all mutation up to the moment of the request in the view so the query should work fine. Could you copy the view query you are running with a few sample docs so I can get a reproducible case on my end?