document disappeared after sync

56 views
Skip to first unread message

Robin Lu

unread,
Feb 19, 2014, 4:45:29 AM2/19/14
to mobile-c...@googlegroups.com


I am using couchbase-lite-ios 1.0 beta2 and sync_gateway 1.0 beta2.

I have a doc in a channel I have access right. It was marked as "_removed:true" after a sync. I checked the document on couchbase the found the document is:

{
  "_sync": {
    "rev": "11-ded56d6df9c7fa540f838de087453a82",
    "sequence": 14640,
    "history": {
      "revs": [
        "1-4586e3607a3e2582aeadd7db26ecd242",
        "2-f22d07deb279c0c3ca7e03db15ed2bae",
        "6-b713039c1e5331ba11e2d16e766339ef",
        "7-6ab42187491ba3da0bf96bf41dc0174d",
        "8-f77eddfefbe8ab21b895a9d460c8f76f",
        "10-0d82085ad9975b591c4dba33c2e09a5a",
        "11-ded56d6df9c7fa540f838de087453a82",
        "3-5ae8831a20737bf83ab5dbebc7656125",
        "4-7ae9b5b8596316b484a661dc4044293d",
        "5-faeb8c76a96cd8b09e612f89c18adb12",
        "9-3df47ba706c894beced671cabea7fbea"
      ],
      "parents": [
        -1,
        0,
        9,
        2,
        3,
        10,
        5,
        1,
        7,
        8,
        4
      ],
      "bodies": [
        "",
        "",
        "",
        "",
        "",
        "",
        "",
        "",
        "",
        "",
        ""
      ],
      "channels": [
        [
          "aa7634fc7a46e663aad755ed94001420"
        ],
        [
          "aa7634fc7a46e663aad755ed94001420"
        ],
        [
          "aa7634fc7a46e663aad755ed94001420"
        ],
        [
          "aa7634fc7a46e663aad755ed94001420"
        ],
        [
          "aa7634fc7a46e663aad755ed94001420"
        ],
        null,
        null,
        [
          "aa7634fc7a46e663aad755ed94001420"
        ],
        [
          "aa7634fc7a46e663aad755ed94001420"
        ],
        [
          "aa7634fc7a46e663aad755ed94001420"
        ],
        [
          "aa7634fc7a46e663aad755ed94001420"
        ]
      ]
    },
    "channels": {
      "aa7634fc7a46e663aad755ed94001420": {
        "seq": 14640,
        "rev": "11-ded56d6df9c7fa540f838de087453a82"
      }
    }
  },
  "channels": [
    "aa7634fc7a46e663aad755ed94001420"
  ],
  ...
}

It looks like it's still in the channel and all the other documents in the same channel can be accessed correctly. Why this document is marked as "removed" on my client side?

Thanks!

Robin Lu

unread,
Feb 20, 2014, 7:51:27 PM2/20/14
to mobile-c...@googlegroups.com
Any one see this?

The channel information is still in the document but the document is marked as removed after the channel is synced to the client. What could cause this?

J. Chris Anderson

unread,
Feb 21, 2014, 10:44:40 AM2/21/14
to mobile-c...@googlegroups.com
It would be more helpful if you can share your sync function and the document data you are creating on the mobile device. A document will only be removed from a channel if it is  modified. By looking at the before and after versions of the document, and the sync function, we should be able to find the reason.

Jens Alfke

unread,
Feb 21, 2014, 12:08:41 PM2/21/14
to mobile-c...@googlegroups.com

On Feb 21, 2014, at 7:44 AM, J. Chris Anderson <jch...@couchbase.com> wrote:

I have a doc in a channel I have access right. It was marked as "_removed:true" after a sync. I checked the document on couchbase the found the document is:

The structure of the data in the gateway’s private bucket is not intuitive at all. It’s designed to handle some tricky special cases, not to be readable by developers :) It’s best not to look in there, unless you’re familiar with the gateway source code (at least document.go and rev_tree.go.)

The best way to look at the channel membership of documents is to use the ?channels=true option to _all_docs:
GET :5985/db/_all_docs?channels=true


    "channels": {
      "aa7634fc7a46e663aad755ed94001420": {
        "seq": 14640,
        "rev": "11-ded56d6df9c7fa540f838de087453a82"
      }
    }

What this is saying is that the document was removed from the channel “aa76…” at revision 11. (If it were still in the channel, the value in that map would be null.)

—Jens
Reply all
Reply to author
Forward
0 new messages