Best practice for date dependend maps

2009-08-07 Thread Mario Müller
Hi folks, I'm new to couchdb (so please don't hurt me ;)). I want to build a view of valid documents. Valid, in this case, means that those documents have a valid_from and a valid_until date and now must be within this range. I've written a map script to do the work for me, but I do not

Re: Best practice for date dependend maps

2009-08-07 Thread Robert Newson
I don't think that will work. the new Date().getTime() is evaluated once for each document, so your expectation that documents will fall out of the view as time moves on will not be met; unchanged documents are not updated in the view. All I can think of is two views with a client-side join.

Re: Best practice for date dependend maps

2009-08-07 Thread Nitin Borwankar
Hi Mario, Looks fine to me ( I didn't look at the regex detials just at the couch stuff. Except you may want to add a check like if(doc.valid_from) {} if(doc.valid_until) {...} This way if a doc doesn't have one of these it will just be skipped. Otherwise you might get a can't format

Re: Best practice for date dependend maps

2009-08-07 Thread Chris Anderson
On Fri, Aug 7, 2009 at 2:15 AM, Mario Müllermario.mueller@me.com wrote: Hi folks, I'm new to couchdb (so please don't hurt me ;)). I want to build a view of valid documents. Valid, in this case, means that those documents have a valid_from and a valid_until date and now must be within