New name _sync:user document

I have two completely separate instances of Couchbase + Sync Gateway.

  1. Couchbase 7.1.1 + Sync Gateway 3.0.4
  2. Couchbase 7.1.1 + Sync Gateway 3.1.0

When logging into my app, the id token is used to create a Sync Gateway session and thereby a user. However, I noticed a difference between the _sync:user: documents for the two Sync Gateway versions.

  1. _sync:user: + JWT issuer + “_” + JWT subject
  2. _sync:user: + bucket name + “:” + some random UUID

I can’t find any other cause that would explain this change. The configurations of the two instances are the same as far as I have checked.

Can someone explain to me exactly how the new document name is composed? So far I could easily retrieve the document via our backend (since we used $issuer_$subject as user ID) e.g. to get the email address of a given user ID, this is no longer possible. I haven’t found the random UUID anywhere else in any Couchbase / Sync Gateway documents and don’t know where this UUID comes from. Is this just randomly generated or does it come from somewhere else?

The _sync metadata documents are internal system documents intended to be used exclusively by Sync Gateway. Which means, we can change the structure of the metadata at any point - as we introduce new features. They are not expected to be consumed by apps. Can you elaborate on why you are directly accessing _user documents and not going through the SGW REST API for instance to fetch user info. CC @adamf