You could also base64 encode the document ID for use as the channel.
- Legal Characters for Document ID - 1 Update
Jens Alfke <je...@couchbase.com>: Jan 15 08:30AM -0800
> On Jan 15, 2015, at 3:11 AM, Andrew Tokarev <andy.t...@gmail.com> wrote:
> I recently found out that custom doc_id is not validated on iOS/Android (might be true for other platforms).
> So it is possible to pass something like: "£%&-7", which causes exception on SyncGateway (no crash).
That is a valid document ID.
> 15:19:44.729250 CRUD+: Invoking sync on doc "£%&-7" rev 2-d36047fd7682b8f3255a0652ba510790
> 15:19:44.729562 CRUD+: No old revision "£%&-7" / "1-691feb51f7ea0da0c8e56132396a0451"
> 15:19:44.729856 WARNING: Sync fn exception: 400 Illegal channel name "person-£%&-7"; doc = map[_id:£%&-7 type:Person _revisions:map[start:%!s(float64=2) ids:[d36047fd7682b8f3255a0652ba510790 691feb51f7ea0da0c8e56132396a0451]] _rev:2-d36047fd7682b8f3255a0652ba510790] -- db.(*Database).getChannelsAndAccess() at crud.go:686
…but that same string is an illegal channel ID. Doc and channel IDs are not the same thing. It can be convenient to name a channel after a document, but if you do that you need to ensure [on the client] that the document is given an ID that's a valid channel ID. Or your sync function could escape characters in the doc ID to make it a valid channel ID.
—Jens
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to mobile-couchba...@googlegroups.com.