Yes...you can..but you might want to change your view first. Index on
time...that is to say emit the creation date in milliseconds into the
view...then use startkey=now() /endkey =now() - 7 days or something.
On Jan 29, 2015 8:03 AM, "TAE JIN KIM" <[email protected]> wrote:

> Are you sure I can use list function for this purpose?
> I tried, but it is same behavior.
>
> > Date: Thu, 29 Jan 2015 04:45:49 +0400
> > Subject: Re: Why am i seeing this behavior?
> > From: [email protected]
> > To: [email protected]
> >
> > View function get executed once on view resource request for only
> > updated documents.
> > Once document get indexed, the result is stored in view index file and
> > read from there since that moment.
> > If you need request-depended view results use list functions instead.
> > --
> > ,,,^..^,,,
> >
> >
> > On Thu, Jan 29, 2015 at 3:33 AM, TAE JIN KIM <[email protected]>
> wrote:
> > > Hello,
> > >
> > > Here is my view.
> > >
> > > function(doc) {
> > >       var cloned = eval(uneval(doc));
> > >       cloned.status = myfunction(cloned.createddate);
> > >   …
> > >  ..
> > > }
> > >
> > > function myfunction(cd) {
> > >     var currentDate = new Date();
> > >     ……..currentDaate - cd… // calculate date difference…
> > >
> > > }
> > >
> > > bascially, myfunction returns some status based on date difference...
> > > I am consuming this one via rest API, ..and this works fine..but..the
> thing is that...it looks CouchDB doesn't always run this whenever this is
> invoked by API?..somehow return cached version??
> > >
> > > I meant...let's say here is some expected table...
> > >
> > > Here are expected Values
> > >
> > > 3 Days ago - 'Status A'
> > > 2 Days ago - 'Status B'
> > > yesterday  - 'Statuc C'
> > > today - 'Status D'
> > >
> > > So I am expecting to see the status value, which is 'Status D' today,
> but it still shows 'Status B' for some reason via Rest API.  I have to open
> couch db web admin interface to run this view manually in order to see
> correct status value, which is 'Status D'.
> > >
> > > Why is that?...
> > > Any idea?
> > >
> > > Thanks,
> > >
> > >
>

Reply via email to