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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -