Thanks a lot. Much appreciated. On Tue, Dec 1, 2009 at 10:55 AM, Alex P wrote: > you don't need any of that with couch. write queue work items as separate > documents. then build a view that just returns all non-started work items: > > function (doc) { if doc.started != true emit(null, null); } > > then from your code call the view with a limit of 1 > (_design/yourdesign/_view/yourview?limit=1) and attempt to save the returned > document with a started flag of true. if someone beat you to it, you'll get > a conflict. if not, you'll save successfuly and do your thing. > > hth, > alex. > > On Tue, Dec 1, 2009 at 8:31 AM, David Carns wrote: > >> I would love to leave SQL behind and migrate to CouchDB.  One of the >> things I have been using SQL for is a rudimentary queuing platform. >> The SQL query that allows this to happen (quite nicely, actually) is: >> >>        update tablename set status = 1 from tablename where id in >> (select top 1 id from tablename where status is null) >> >>        I left out a bunch of NOLOCK arguments and an update to >> another column in the query for better reading >> >> Is there an effective way to do this with CouchDB?  Sorry if this is >> an uninformed question.  A reply of RTFM is fine, but I have not found >> the answer on my own so far. >> >> Thanks in advance. >> >> -David >> > -- David Carns