First of all, thanks for your response.
Can you elaborate on how are you are “clearing the document channel”?
In our API, we have something like this :
executeQuery("UPDATE " + bucketName() + " SET channels = [] WHERE conditions");
I also test manually by clearing the document channels directly on the Admin UI (Documents > Document ID = > Edit Document > Clear the channel > Save)
Can you please include the CBL and SGW versions .
I updated the initial post (CBL : 2.8.5
and SGW : 2.7.1
)
Why are you “recovering” the database and inspecting it manually with cblite tool ?
I’m sorry, “recovering” was not the good word. I simply pull the database into my computer thanks to adb
, and then open it with cblite
.
I think this is the best way to check what is inside my database because we don’t display every documents in our app (some are hidden depending of their state).
What happens when you query for documents in database in the app via the CBL API (or just retrieve a document via Id) ? Do you see that document returned in the query response
The following code check if the document 9c99d8bf-5f5e-4c56-96d8-b8c40b3e7472
(with an empty channel) exist :
fun getById(id: String) {
db.getDocument(id)
?.let { Timber.d("The document $id does exist") }
?: Timber.d("The document $id does not exist")
}
And the output is :
2021-04-16 17:51:15.533 D/VisiteDao: The document 9c99d8bf-5f5e-4c56-96d8-b8c40b3e7472 does exist
It’s a bit confusing with the email address etc - Is that the channel Id and the docId?
The channel ID is the user email address. This is not the document ID.
Great, I didn’t think about this command. The _raw REST
command give us a strange document indeed :
{
"channels": [],
... // Document properties
"_sync": {
"rev": "94-51c704ba1cb4bf4816b4817d600e4cde",
"sequence": 985436,
"recent_sequences": [
976147,
976152,
976155,
976157,
985430,
985432,
985434,
985436
],
"history": {
"revs": [
"66-8a685bb4c4eaee47106fd2d2dcbc19af8caeca45",
"7-272bdbd92997ca536ef4ec5d78e8486b0e5c2f9d",
"82-279cbe86130884d13f8e5115d7e1c711073f2c49",
"45-ca7c35d2bc22d1a04af5e2685a8a3104b19a90b0",
"54-17c209c8104e4ec1e2d60e07388c7718fbbd66d0",
"29-550d1b17b344f833387c167d7f0d9c21307aaeab",
"80-a1db141b1bb3d83ac4c114bdeec81bba9cb2fd0f",
"76-67c9e30b8d7ad377a1c0bc47fb8ab4bef88e5fe7",
"49-80ce59106d35739e238421fbe3e7a0d9938645a3",
"38-f0e0d5058f5b494a34a131fb4f833561a3e28db9",
"77-fa6da5fbb611f69fc1b9cf16a79175736a2daf74",
"48-a07cc935c4a2afcd35f6c5caff275dc17e17655a",
"46-94e4060ba068b1e3bb1ef9a41ca237b6f5119aa6",
"13-8dafe128081cedad2c0afa722f1ca510be1c485a",
"42-722b7750fb43423cdab6ecbfc9deea0075d70ef3",
"24-6544ebec6160c6c0c898dcf90c29ebc0ad03904b",
"2-ea81340dc2ea8c9f3c746dbe960241e4",
"8-6d93c566124a3caf086cea6f87ff3ba47a30f25f",
"69-330362ef3ee326b3396278c8ec93938eeea0aa40",
"61-8a1cb8457a734ce207b23ee3756733ef626c09b3",
"81-cf8411f0238ff6dfb1fc3a26aed14260dfb82cfe",
"55-c09058d375e5bccbad9229572e6110894ac4f6fb",
"30-6a7f1f8b5ec6ccb0434681e799c1da8d6b437a5a",
"78-6edd2981122ab4a2f6b50b565e0b0ce3764bdd0d",
"11-99bf03d3dcccc96be3940f5930c422918ba0fd2a",
"41-839b19fd778c910ecdb6ac7d7113e6a260187f93",
"94-51c704ba1cb4bf4816b4817d600e4cde",
"37-2f4c239e96e3b9ca7902cf8056cca4a9561a8df0",
"6-21b13abb618ad772cd9e9e257dd69a046048c04e",
"34-42c6956a2694c8e1f5b1d4da82e596ad4232b97b",
"84-52bf56c2420e1793414b25ea46145c6de5d12f5d",
"86-d70680a7b8910fbcf01b8f0fc424aabd575f3e68",
"4-100e96ac3dbf59e3cd5d25e78050992ac4fc0c7c",
"22-4c79bcab3233def578d1e4d066fb2ef10daa0397",
"67-318ff26ee44134feaf2dd84d565579466e3a4b33",
"20-14e8de81682a1682fbc0322c8470ecfd83e82110",
"56-ff5c46cdd9a7c19cb1a9b73a0ac0b93ee88f4efd",
"51-b2af787cfd066a163f8312ab6ec7b04690e2cbc7",
"50-a4c50e914e5d1687650cf0875288c310376c2be8",
"65-b425b239f4cd5512d99838283c6405b49b190ed7",
"31-299de0e18402881b02939ca5395b5620c67e7690",
"9-1fa3b9d08c0d3f146c2458686f7ef92a0a508512",
"28-5fd889737a9236351621175bc5ed7f9a272a3a8d",
"17-7e2208a1dc8cda92b62dbf3a79de822157e03d2c",
"87-2370d369cd3a43ed59ffda8b9cfbed910f826b00",
"39-00a382cde69fbc6bf7fdc42d329c9cef9ce33894",
"36-5df3f36a2ec7ef6bc4a021899ed9f7862372fc1a",
"33-40319b428b8a1dee5402b6f9ec8446c492a7f80a",
"58-42a3e92b2e82b64da2d60051e45d71ed27546d37",
"35-d77533426b59878b62811f61fe3a8642964b2259",
"5-0407753d2835557b9e68348fa9e837ffa68ccd86",
"47-d0a4cbf898b0fd4e0ea79882a0cdfbb30af41f1f",
"14-5c59498f333a7339108561aaba64abd835a9649c",
"10-73e9198c940eba1322a6e8e8a34b1403e1fe77ac",
"52-164f1d8b1dfef1a6ad9367919efd9c45e5801c96",
"64-5d1fb34e15693236f3e03d8689f6f5646504fc00",
"27-1c1c41b9cad278c310e9727db88f1402028cfca9",
"72-eaca7c6d2ee150f3274886418d7c2ab3f41cead5",
"53-67975ddd331a1bc50670760eaff73bddab1add30",
"57-c49a55f7920fef92c296be39d6ffdd5933a23f5b",
"26-4c010d2747eac3e15cedb8a7771984ea5667747a",
"59-2bba72d557d4970c66b292af370e14dc6cd4a96b",
"62-3221f6559e60def1891f984f9b499a8efca52e00",
"1-19fbc33c2f43e42cd4f833b44cf154d5",
"83-f1aacc344c7301a3db6f89de966a159fe2d1888b",
"3-c656d7404bd3f7d3425cd7f86a789961",
"18-62b3be883f77f1efa0221649c797a6230619c685",
"70-eea4498fd04212a1ef94e46b049bf82bc3af1f9c",
"88-f6376866c9bcc1103517bc079d6b8322346accc9",
"15-cd6dcde87b9dfb75b1a27282810b4eb8f9896583",
"75-dadd9aa7df65456f4ef264b3d3046c5e472a613a",
"71-84c7e88ceda89782d0bac55fa3d6a5d5e290ef48",
"21-a27e412c0b6a83f550f395de8061f352e49af0ad",
"43-251b726d187933e65120500edd7953ed5a545d2a",
"19-710dcf4d26c4fb45672aef6ce072753287ff0cf1",
"68-f78957c9ee7d5fdfdc3628ca0f6b574e36ae5ad2",
"74-0d142e8c59571676b7ac434da04bd36ae473a8a4",
"79-bc4967b365951e8d2b9754a7cba578d34f9fcf5a",
"93-e5af72ba52ad611976c57bf6d359199d62dac665",
"12-729685bd28b7ab3daf19f3db11771618fedfb8de",
"63-b6dfbff2d89e1748849021dbe39309f9b5bcee7c",
"90-6ecd86d46b3c6ad2c2cd5fc6584a2845fe06982e",
"44-2bc4984b5646e882c09d39025cd79faf194c91d8",
"23-d8c3a6d0e7fbde64ab591d4d0fc944be8e4bfcef",
"91-12a9c6df05630f26e4b40a1f2872e77a7904073d",
"85-a0a264f0a54ee2eea017ecb1ddeb14f325bafcd2",
"92-6ffe7dae72909ac267e146844fad9e2a8a2c74f3",
"60-041649db7818dc30752b47cfdb60c44ed9706b6d",
"16-d6d72c0774ad7e95cd5e42ccbd578508130351e4",
"73-cdd667dc11bfdecce84dd9c2fa12114b20ce171c",
"89-47000b8b2af732ce0cea3dae20172ce1a2b11f97",
"40-1d46f9920b914d1e07e55175ce1c20a80ab2adaa",
"32-66452c21ce773234a97e3d841c091d4f00242f7a",
"25-ad01f9222af77c4e98f1c59b04ca8a9dcb072c34"
],
"parents": [
39,
28,
20,
82,
58,
42,
77,
70,
11,
27,
7,
51,
3,
79,
25,
83,
63,
1,
75,
87,
6,
4,
5,
10,
53,
91,
78,
46,
50,
47,
64,
85,
65,
72,
0,
74,
21,
38,
8,
55,
22,
17,
56,
88,
31,
9,
49,
92,
59,
29,
32,
12,
13,
41,
37,
80,
60,
71,
54,
36,
93,
48,
19,
-1,
2,
16,
43,
18,
44,
52,
76,
67,
35,
14,
66,
34,
89,
23,
86,
24,
62,
90,
73,
33,
81,
30,
84,
61,
69,
57,
68,
45,
40,
15
],
"channels": [
[
"user@mail.fr"
],
[
"user@mail.fr"
],
[
"user@mail.fr"
],
null,
[
"user@mail.fr"
],
[
"user@mail.fr"
],
null,
null,
null,
[
"user@mail.fr"
],
[
"user@mail.fr"
],
null,
null,
null,
[
"user@mail.fr"
],
[
"user@mail.fr"
],
[
"user@mail.fr"
],
[
"user@mail.fr"
],
null,
null,
[
"user@mail.fr"
],
null,
null,
null,
null,
null,
null,
[
"user@mail.fr"
],
null,
[
"user@mail.fr"
],
[
"user@mail.fr"
],
null,
null,
[
"user@mail.fr"
],
null,
null,
null,
null,
[
"user@mail.fr"
],
[
"user@mail.fr"
],
null,
[
"user@mail.fr"
],
null,
[
"user@mail.fr"
],
[
"user@mail.fr"
],
null,
null,
[
"user@mail.fr"
],
[
"user@mail.fr"
],
[
"user@mail.fr"
],
null,
null,
[
"user@mail.fr"
],
null,
null,
null,
[
"user@mail.fr"
],
[
"user@mail.fr"
],
[
"user@mail.fr"
],
[
"user@mail.fr"
],
[
"user@mail.fr"
],
[
"user@mail.fr"
],
null,
[
"user@mail.fr"
],
null,
[
"user@mail.fr"
],
null,
null,
[
"user@mail.fr"
],
[
"user@mail.fr"
],
null,
[
"user@mail.fr"
],
[
"user@mail.fr"
],
[
"user@mail.fr"
],
null,
null,
null,
null,
[
"user@mail.fr"
],
null,
null,
[
"user@mail.fr"
],
[
"user@mail.fr"
],
[
"user@mail.fr"
],
[
"user@mail.fr"
],
null,
[
"user@mail.fr"
],
[
"user@mail.fr"
],
null,
null,
[
"user@mail.fr"
],
null,
null,
[
"user@mail.fr"
]
]
},
"channels": {
"user@mail.fr": {
"seq": 985436,
"rev": "94-51c704ba1cb4bf4816b4817d600e4cde"
}
},
"cas": "0x00007ad280fb7516",
"value_crc32c": "0x54eb5ff9",
"time_saved": "2021-04-15T10:42:51.81432436+02:00"
}
}
I don’t understand the _sync.history.channels
property. Why is there a difference between the channels
property from the document and channels
property in the metadata ?
If the document doesn’t have cleared channels, it explains why the auto purge is not working.
For the specific user, please check the output of the user REST call. See what channels the user has access to
We already had checked the channels that the user has access, and we didn’t saw anything particular :
{
"name": "anothername",
"admin_channels": [
"!",
"agence:107731933",
"user@mail.fr"
],
"all_channels": [
"!",
"agence:107731933",
"user@mail.fr"
],
"email": "user@mail.fr"
}
Next is to look into sync itself. How do you know that the sync was in fact successful.
I tested on visibles documents : we use a live query, so when the sync is successful, the live query is updated, and the view is also updated.