Wednesday, April 2, 2008

A small simplification to "lookups" on the web

In this post, I referred to a method of looking up one document in a view, using the parameters startkey and untilkey.

E.g.

http://server/db.nsf/view?openview
&startkey=alex
&untilkey=alex_



I discovered today (wonder why it took so long) that the good old count-parameter works just as well as the untilkey-parameter. Personally, I think that the count-parameter is more readable than the previous method.

Simplified url:

http://server/db.nsf/view?openview
&startkey=alex
&count=1



I don't know if there is a performance-difference between the two methods. I tried a couple of benchmarks in firebug, but got nothing conclusive.

0 comments: