User loses document access after put request


#1

Hi everyone,
I have a problem with the sync-gateway which i can´t figure out.
The user 73177387776005
{"name":"73177387776005","admin_channels":["UserData::73177387776005"],"all_channels":["!","UserData::73177387776005"]}

should have access to the document UserData::73177387776005
{"Coins":50,"_sync":{"rev":"1-15e25216d6ba6432ab073cee442be8f4","sequence":16259,"recent_sequences":[16259],"history":{"revs":["1-15e25216d6ba6432ab073cee442be8f4"],"parents":[-1],"channels":[["UserData::73177387776005","UserData::all"]]},"channels":{"UserData::73177387776005":null,"UserData::all":null},"cas":"","time_saved":"2018-06-10T12:48:18.426353295Z"}}

This work´s fine. The Problem occurs when I try to update the document.
When I send this put request:
curl -X PUT "http://localhost:4985/app-data/UserData%3A%3A73177387776005?new_edits=true&rev=1-15e25216d6ba6432ab073cee442be8f4" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"_id\": \"UserData::73177387776005\", \"_rev\": \"1-15e25216d6ba6432ab073cee442be8f4\", \"Coins\": 39}"

The document changes to:
{"Coins":39,"_sync":{"rev":"2-ef4f6fb5d7398f47055e56a4cba10e20","sequence":16260,"recent_sequences":[16259,16260],"history":{"revs":["1-15e25216d6ba6432ab073cee442be8f4","2-ef4f6fb5d7398f47055e56a4cba10e20"],"parents":[-1,0],"channels":[["UserData::73177387776005","UserData::all"],null]},"channels":{"UserData::73177387776005":{"seq":16260,"rev":"2-ef4f6fb5d7398f47055e56a4cba10e20"},"UserData::all":{"seq":16260,"rev":"2-ef4f6fb5d7398f47055e56a4cba10e20"}},"cas":"","time_saved":"2018-06-10T12:57:50.717245011Z"}}

Which seems fine to me, but the user 73177387776005 has no longer access to this document.

Please let me know why this is the case.

regards,
Philipp


#2

you need to put channels in each revision if the channel is not passed then the data will not be available on that channel.


#3

Thank you very much for your reply. With your help I could solve the Problem, it was indeed missing channel acccess caused by an incorrect configured sync-function.