Sync Gateway - appending user Id to the document Id

Hi,

I’d like to keep the document Ids unique for each user. In the document I pass the userId as a field. Is there a way to append the userId to the documentId in the sync function?

What I mean, is that when storing a document, say docID: ABC_1 for user Id 333 I I want to actually store document ABC_1_333

when I pull that document I want the client to get document ABC_1 – i.e. the user id trimmed.

Can this be done?

Thank you

No, the document ID is immutable, and the same for anyone using the document. It’s not possible to change a document’s ID or make it look different when it’s replicated.

Thank you Jens - this was embarrassing omission on my part - I was testing with a single user most of the time and only occurred to me when I switched user accounts. It’s fixed now to ensure user docIds are unique for a given user.