Document local update vs Channel added(Server) to same document update

Hi Folks,

Assume
a)Document A is added to local database.
b) UI is Updated with that doc data on DB change callback.
c) At server Document A is updated with channel info to say to whom it belongs to.
d)Now after the channel is added the the same document is getting reflected to Client A.
e)Is there a flag/Property to identify this event on DB change?
f)Need to avoid UI getting updated with the same document.?

public void changed(ChangeEvent Event) {

}
How does the ChangeEvent .isExternal() works? Also how is the ChangeEvent.getChanges() values filled while DB changed callback is given?

We have seen getChanges() giving multiple values in same callback, then hows isExternal() works?

Thanks
Nithin

Hi @nitz_couchbase,
I’m trying to understand line “e”, are you asking for a way to know that the document has been synced to another client?
or
That the document came from an external source?

Are you developing in C# and Xamarin?

I think you’re misunderstanding what the Sync Gateway does. It does not update the document. It just adds some local metadata (the channel assignment) that helps it route the document and apply access permissions.

So the client will not see a new revision of the document. Only clients change documents (or sometimes app-server code that talks to the Gateway’s REST API.)

@jens d)Now after the channel is added the the same document is getting reflected to Client A.

Here channel addition was done by app server itself…so the rev gets changed and same doc is synced back to client A.

CBL should have is isDocCreated/isDocUpated api right?

“I think you’re misunderstanding what the Sync Gateway does. It does not update the document. It just adds some local metadata (the channel assignment) that helps it route the document and apply access permissions.”

Pls elaborate on this…

Thanks
Nithin

I don’t know what that means?

Pls elaborate on this.

Replication doesn’t create new revisions, it just moves revisions from one place to another. SG’s replicator doesn’t get to modify the document when a client syncs to it, it just stores the revision sent by the client.

Assigning a doc to a channel isn’t a change to the document. It’s just metadata that controls access and routing.

@jens Assigning a doc to a channel / Assigning a Channel to a Doc is done by our App server…hence there is revision change…

" documents can only be added to channels when they are updated since the channel assignment is part of the revision"

Is there a way to update channels without creating new revision?

Thanks
Nithin

No, there isn’t. Part of the architecture is that the content of the document determines what channels it’s in.