you can't think of complex keys as a boolean "AND", but as a single value.

so...

["2012-01-01T02:07:50.387+0000","97ee813bfe4dbbf80a48b018b20a08bb"]

is actually less than ALL your values because of CouchDB's collation rules.

To explain this to others, I use the idea of turning the key into a sentence.... typically i think of it as you have the last element grouped by the the other elements from left to right.

So you have "restaurantids grouped by timestamp" as your key, which means for any given timestamp as a startkey/endkey, the last item in the key will be a restuarantid... if you try rounding your timestamp to the nearest hour in your example you'll see what I mean using your data...

if you want to look up by restaurantid, order your keys from left to right... [restaurantid, timestamp]... which will then order your view first by restaurantid, then by timestamp... which gives you "timestamps grouped by restaurantid"

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

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