couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mathieu Castonguay <mcastong...@justlexit.com>
Subject starkey with multiple values not working as expected
Date Wed, 29 Feb 2012 23:45:17 GMT
Here is the view:

   "restaurant_orders_after_date": {
       "map": "function(doc) { if(doc.restaurantId &&
doc.timeOfLatestStatusChange && doc.status && (doc.status == 'ACCEPTED' ||
doc.status == 'REJECTED')) {
emit([doc.timeOfLatestStatusChange,doc.restaurantId], doc._id)}}"

Execution of the view:

restaurant_orders_after_date?startkey=["2012-01-01T02:07:50.387+0000","97ee813bfe4dbbf80a48b018b20a08bb"]&endkey=[{},"97ee813bfe4dbbf80a48b018b20a08bb"]

{"id":"6bb4423653c6d9138524c110cf0047fb","key":["2012-01-03T14:00:52.542+0000","f98ba9a518650a6c15c566fc6f03dc8d"],"value":"6bb4423653c6d9138524c110cf0047fb"},
{"id":"6bb4423653c6d9138524c110cf007276","key":["2012-01-03T17:34:49.565+0000","97ee813bfe4dbbf80a48b018b20a08bb"],"value":"6bb4423653c6d9138524c110cf007276"},
{"id":"6bb4423653c6d9138524c110cf006d26","key":["2012-01-03T17:36:31.222+0000","97ee813bfe4dbbf80a48b018b20a08bb"],"value":"6bb4423653c6d9138524c110cf006d26"},
{"id":"6bb4423653c6d9138524c110cf007c76","key":["2012-01-03T17:38:45.485+0000","97ee813bfe4dbbf80a48b018b20a08bb"],"value":"6bb4423653c6d9138524c110cf007c76"},
{"id":"6bb4423653c6d9138524c110cf006119","key":["2012-01-03T17:47:51.637+0000","29b384e85adcdf5b2085dadba5018d03"],"value":"6bb4423653c6d9138524c110cf006119"},
{"id":"6bb4423653c6d9138524c110cf005e51","key":["2012-01-03T18:00:35.185+0000","29b384e85adcdf5b2085dadba5018d03"],"value":"6bb4423653c6d9138524c110cf005e51"}

It seems to completly ignore the second value which is the id of the
restaurant. I want all orders who's timeOfLatestStatusChange is greater
than the current time (in this case "2012-01-01T02:07:50.387+0000") and
who's restaurant id is a certain value(in this case
"97ee813bfe4dbbf80a48b018b20a08bb").

Can anyone explain to me why the second parameter seems ignored, I can mean
I can put "donkey" and it still does the same thing.

Thank you,

Matt

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message