couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Rothbucher <sebastianrothbuc...@googlemail.com>
Subject Re: changes feed / include delete doc?
Date Sun, 21 Feb 2016 14:27:38 GMT
Hi Flo,

if I'm not completely mistaken, the changes feed does contain the last
revision of a modified document or a deletion stub. See the following
example:
$ curl -X GET '
http://localhost:5984/test/_changes?feed=continuous&heartbeat=3000'
# (some changes)
# fire foff
$ curl -X PUT 'http://localhost:5984/test/bla' -d '{}'
{"ok":true,"id":"bla","rev":"1-967a00dff5e02add41819138abb3284d"}
# produces changes feed
{"seq":4,"id":"bla","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
# fire off
$ curl -X DELETE '
http://localhost:5984/test/bla?rev=1-967a00dff5e02add41819138abb3284d'
{"ok":true,"id":"bla","rev":"2-eec205a9d413992850a6e32678485900"}
# produces changes feed
{"seq":5,"id":"bla","changes":[{"rev":"2-eec205a9d413992850a6e32678485900"}],"deleted":true}

2-eec205a9d413992850a6e32678485900 is in fact the deletion stub's revision
ID

hope if helps - otherwise pls. let us know

Best
      Sebastian

On Thu, Feb 18, 2016 at 3:29 PM, Florian Lohoff <f@zz.de> wrote:

>
> Hi,
>
> i am trying to build a changes listener and for all docs which got
> modified or deleted i'd like to get the last version for comparison.
>
> I am right now using a construct like this:
>
>
> /couchdb/fidb/_changes?feed=continuous&since=X&include_docs=true&heartbeat=3000
>
> Get the deleted or changed entrys - Fetch this:
>
>         couchdb/fidb/<delorchangeddocid>?revs=true&open_revs=all
>
> And then fetch the deleted/changed documents revision.
>
> Is there an easier way i simply didnt recognize?  include_last_rev=true ?
>
> Flo
> --
> Florian Lohoff                                                 f@zz.de
>       We need to self-defend - GnuPG/PGP enable your email today!
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iQIVAwUBVsXVXZDdQSDLCfIvAQoM4g//Zb3x2RYWzP2xmZS/Bn8DtnKzPYom2IhN
> lqi/99/WYhtTDsGQroPF06z7oLFG5+/QmgswOSrAYq+4wMGLzdVwFINCoYDhionQ
> EqcKbfuu1Rd0zGPXUaGdHNfNvpRd6lHjRIvrEmsBz/2+toMMO/59p01R2GDdecsc
> 5kFlhxrBjCR0j9b+f6gQqKVoY5iq6Rc7947ukx0Ja4D7Orlp/MP95wyKI+o9IS5w
> rozMDW8Dy46DQbwMwO+tz4RKPMVpug7DOvPH7p+RS1nm7TrnZV0Db5ZeM7mynIN/
> T7mqa+Anc+L2efEhZAVLv2dGDXikndS0SBKHsxYimFcv6U1eJ7mz5aMhOnsmnelu
> ed/MUsuofmo056JksW5pNjPukCTFzcSwEC8BL4L315BhW6BY9r4CT+BoT32LB3UI
> Q2TNiAhG+xl5LUI9ScCtdPflEidpWflk41Erbk0gdwaLw+BevMinsYGJAhJtN7ji
> 8An4gPPUCWLSjFAB7e8eFPHTIQhvySTkaqnSbsdfEdzc9oEEo87c4shLBZqHMzsE
> UmPF+O/1d7Ynx5jCjob3+T8PrR7iI9oCwGlrjbM6BL2VnAu46R6iKtGTs00Chg0p
> uekXO58gN+wrcUrc3QL66j7B1DK10PS0TELBW9hULfq6oyiDrK7WEZXIPZZW2tbY
> jXlnkGTYvDs=
> =AlS3
> -----END PGP SIGNATURE-----
>
>

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