Unmarshalling error in Sync Gateway when a change is saved to the document in Couchbase Server

253 views
Skip to first unread message

Gareth Clay

unread,
Aug 7, 2014, 10:57:03 AM8/7/14
to mobile-c...@googlegroups.com
Hi there,

I've tried running both 1.0.1 and a fresh build of the Sync Gateway code on master, and I'm getting this error when changes are made to my test document on the Couchbase Server side (via the web ui):

15:44:01.689888 WARNING: Error unmarshaling doc "activity-gareth-2014-08-02T15:47:29.262Z": json: cannot unmarshal string into Go value of type []string -- db.(*document).UnmarshalJSON() at document.go:237

My document looks like this:

{
  "_sync": {
    "rev": "1-b754f3a834d0ae1b53076a9fd86221ab",
    "sequence": 1,
    "history": {
      "revs": [
        "1-b754f3a834d0ae1b53076a9fd86221ab"
      ],
      "parents": [
        -1
      ],
      "bodies": [
        ""
      ],
      "channels": [
        "*"
      ]
    },
    "time_saved": "2014-08-07T13:50:33.0106696+01:00"
  },
  "data": "foo, bar, baz, foobar",
  "durationSeconds": 0,
  "name": "test recording 2"
}

The original document was synced over to the server successfully from my Couchbase Lite app, but I've yet to see a successful sync back of server side changes. The change I made here was to add ', foobar' to the "data" value. As far as I can see the document is valid...

I'm using Couchbase Server 2.2.0 community edition (build-837).

Does anyone have any ideas please?

Jens Alfke

unread,
Aug 7, 2014, 8:05:30 PM8/7/14
to mobile-c...@googlegroups.com

On Aug 7, 2014, at 7:57 AM, Gareth Clay <garet...@gmail.com> wrote:

I've tried running both 1.0.1 and a fresh build of the Sync Gateway code on master, and I'm getting this error when changes are made to my test document on the Couchbase Server side (via the web ui):

Please don't edit documents in a bucket belonging to Sync Gateway. It won't work correctly — you won't be updating the metadata inside the _sync property that tracks the revision history.

If you want to update a document stored in the gateway, your two options are
(a) use the Sync Gateway's REST API to update the document; or
(b) set up bucket shadowing so your Sync Gateway db acts as a 'shadow' of a separate Couchbase Lite bucket that you own and can change as you wish.

—Jens

Gareth Clay

unread,
Aug 8, 2014, 10:24:27 AM8/8/14
to mobile-c...@googlegroups.com
Ah okay, thanks Jens. I'm pretty new to this and so I'm making quite a few naive mistakes I'm afraid! Slowly getting my head around it... :)

Jens Alfke

unread,
Aug 8, 2014, 11:37:43 AM8/8/14
to mobile-c...@googlegroups.com

On Aug 8, 2014, at 7:24 AM, Gareth Clay <garet...@gmail.com> wrote:

Ah okay, thanks Jens. I'm pretty new to this and so I'm making quite a few naive mistakes I'm afraid! Slowly getting my head around it... :)

Here are some relevant docs. That page talks about bucket shadowing but links to the REST API docs too.

—Jens

Tim Clarke

unread,
Dec 10, 2015, 6:46:57 AM12/10/15
to Couchbase Mobile
That link doesn't work any more. I have same "Error unmarshaling doc" error using sync gateway v1.1.1 when a document changes in the bucket.

Should I be using bucket shadowing? The "shadow" feature isn't mentioned in the latest sync gateway documentation so how do I know the syntax to use in my config.son?

thanks
Reply all
Reply to author
Forward
0 new messages