Couchbase document dates search - DateTime.Now() -


i have document in cb has 2 dates, start date , end date. let's say, product's price discount. 10% off starting today , ends next friday. how can documents cb have valid discount today?

i made view , have following in it:

var dt = new date(); 

which gets today's date. can simple

if(doc.fromdate < dt && doc.todate > dt){ emit([ ..... ]); 

this filters documents how want. but...

question

is approach re view , index updating? index update every day because date changed? trying understand working of cb in respect

what best approach type of searching? if not possible please tell me!

cheers

robin

note: please note, question not here or here

the index won't updated because system date changed, have update document. view indexer doesn't allow pass arguments defined user. in case should emit data , use date part of key filter on view query. guess same behaviour sql indexes too. cannot predict when document indexed, in example freezing timestamp when doc has been indexed, isn't time when changed


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -