Should N1QL update queries always add where meta().id not like '_sync%'?


#1

I’m using SyncGateway w/Couchbase and all my documents contain an owner attribute. Occasionally I need to change the owner of some documents to a different owner using N1QL in the CB Query Workbench.

I have been excluding the SG documents (those with meta().id starting with ‘_sync’). Should I also be updating them? Sometimes it seems I need to restart SG to get the changes to propagate to my clients resynchronizing via PouchDB.

Also is there a discussion online on the purpose of the _sync records?

Thanks,
Steve


#2

It all depends on what you want. If you want only updates documents that start with _sync you can add the predicate.


#3

Thanks. I guess I’m wondering what the purpose of the _sync ids is? I’m assuming SG creates them? I don’t know if updating them would break replication in some way?


#4

I am not expert in that area. cc @priya.rajagopal


#5

@saschwarz You’re correct - the _sync prefixed documents are internal mobile data created by Sync Gateway, used for a variety of functionality, including replication. They shouldn’t be modified by anyone other than Sync Gateway.


#6

Thanks @adamf I’ll steer clear :slight_smile: