Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ECF3B107AF for ; Sun, 7 Apr 2013 19:53:11 +0000 (UTC) Received: (qmail 31689 invoked by uid 500); 7 Apr 2013 19:53:09 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 31656 invoked by uid 500); 7 Apr 2013 19:53:09 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 31647 invoked by uid 99); 7 Apr 2013 19:53:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Apr 2013 19:53:09 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of bchesneau@gmail.com designates 209.85.216.49 as permitted sender) Received: from [209.85.216.49] (HELO mail-qa0-f49.google.com) (209.85.216.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Apr 2013 19:53:05 +0000 Received: by mail-qa0-f49.google.com with SMTP id i13so515891qae.15 for ; Sun, 07 Apr 2013 12:52:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=oHM+K+LzxR2qU7m7Ivnz5JfDxPfLnBoEI+N+XtvvBOQ=; b=BXxEmG9Vkm1mUMPxPUhk4TN2CssohLSvSrYHA0ermdpgmlBp3kBraqXjWei8g7QRQY zGTI11SyRxGQihUyDjcbHrwgqkSD+oCW8/kTqOqOyezM7fimXDsEBL/nyuF7pIxIpqxG cGwbqA0abAjQMsF8kZ3K+Mz64CTLzyklmIMqDRWNjnxLXOHlH0MKyi9a2HEVM9PomI1f uHzHn8qLcf/ZAL/lOYBsgonzVE0ShfTUld55FtZw2vl6QuDNpLkaWDjg2dnCKOFUIrF5 y48OuREGUzWeoA/d2IoOpdahOXw6zGB0eienZpQ3h5fc1BHDqFiU/LNUUt+wex7t7Fcd Ml2w== MIME-Version: 1.0 X-Received: by 10.229.106.83 with SMTP id w19mr6084483qco.45.1365364364715; Sun, 07 Apr 2013 12:52:44 -0700 (PDT) Received: by 10.49.64.232 with HTTP; Sun, 7 Apr 2013 12:52:44 -0700 (PDT) In-Reply-To: References: Date: Sun, 7 Apr 2013 21:52:44 +0200 Message-ID: Subject: Re: How To Retrieve JUST The Latest Rev Of A (Design) Doc - Check For CouchApp Update From: Benoit Chesneau To: "user@couchdb.apache.org" Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Here is some code in Python to get latest rev: https://github.com/benoitc/couchdbkit/blob/master/couchdbkit/client.py#L462 On Sun, Apr 7, 2013 at 6:11 AM, Brad Rhoads wrote: > It looks like that a HEAD request should work. But in my code below, it > doesn't appear that either the error function or the success function get > called. Note that async:true doesn't make any difference. > > > // Check for application updates > > $('input.updatecheck').live('click', function (event) { > > > > var geturl; > > geturl = $.ajax({ > > type: "HEAD", > > dataType:"jsonp", //need to use JSONP to get to isriscouch > > async: false, > > url: ' > http://user:password@ourdomain.iriscouch.com/ourdb/_design/library', > > error:function (){alert("fail!");}, > > success: function () { > > alert("done!"+ geturl.getAllResponseHeaders()); > > } > > }); > > . . . > > }); > > > > --------------------------- > www.maf.org/rhoads > www.ontherhoads.org > > > On Sat, Apr 6, 2013 at 11:37 AM, Marty Schoch wrote: > >> A HEAD request for the document should return the revision (I think it may >> be in the Etag header) >> >> Marty >> On Apr 6, 2013 12:58 PM, "Brad Rhoads" wrote: >> >> > We're running a couchapp on TouchDB Android. The app has a "check for >> > update" option that of course, just starts a replication against the the >> > version running online. But I'd like to tell the user either "update in >> > progress" or "no update available." >> > >> > It seems that I should just need to compare the rev of the local _design >> > doc against the remote _design doc. Is there a way to request just the >> _rev >> > of the remote doc? So far I've only been able to retrieve the entire >> > document, which in the case of a couchapp is pretty big. >> > >> > As I was just writing that, it came to mind that I might just be better >> off >> > creating a separate document that has a last update/version number in it. >> > >> > Any other approaches to this problem? >> > >> > Thanks for the help! >> > --------------------------- >> > www.maf.org/rhoads >> > www.ontherhoads.org >> > >>