when using GET method with startkey and endkey, it works fine and gives a list of all "datestamp" that falls in the startkey-endkey range:
but when I use POST method with JSON Payload, it just gives all records that has the "datestamp" field regardless of value:
http://localhost:5984/reservations/_design/default/_view/by_datestamp
Payload:
{"startkey":"1438704000004","endkey":"1438704000005"}
My view looks like this:
{
"by_id": {
"map": "function(doc) {
if(doc.id) {
emit(doc.id, doc);
}
}"
},
"by_datestamp": {
"map": "function(doc) {
if(doc.datestamp) {
emit(doc.datestamp, doc);
}
}"
}
}