-
I have a view that filters the data based on the date. In the beginning, it mapped the data correctly but, the next day it also had the data from the day before (the timestamp from the day before). Is there any way I could just have the data from the actual day and not from the day before? Here is the view map function:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
a map function must depend solely on the input The map functions run over each document at index time, not query time, so "today" will be yesterdays date for docs indexed yesterday for queries made today. |
Beta Was this translation helpful? Give feedback.
-
is all you need, you can then get the count of documents for any given day with You first build an index of your document contents and then query the range you want. In your original formulation CouchDB would need to reindex every document every time you queried, and we didn't design it that way for hopefully obvious reasons. :) |
Beta Was this translation helpful? Give feedback.
is all you need, you can then get the count of documents for any given day with
?reduce=true&key=1694127600000
for example.You first build an index of your document contents and then query the range you want.
In your original formulation CouchDB would need to reindex every document every time you queried, and we didn't design it that way for hopefully obvious reasons. :)