Thank you for your response @adamf and @jens.
Below please find the SG configuration file and the raw document and it’s meta data.
Sync Gateway Configuration
{
"interface":":4984",
"log": ["*"],
"logging": {
"log_file_path": "/var/tmp/sglogs",
"console": {
"log_level": "debug",
"log_keys": ["*"]
},
"error": {
"enabled": true,
"rotation": {
"max_size": 20,
"max_age": 180
}
},
"warn": {
"enabled": true,
"rotation": {
"max_size": 20,
"max_age": 90
}
},
"info": {
"enabled": false
},
"debug": {
"enabled": false
}
},
"databases": {
"messaging": {
"import_docs": "continuous",
"bucket":"messaging",
"server": "http://cb-server:8091",
"enable_shared_bucket_access":true,
"import_filter": `
function(doc) {
return true;
}
`,
"username": "Administrator",
"password": "xxxxxxxx",
"users":{
"admin": {"password": "password", "admin_channels": ["*"]},
"demo": {"password": "password"},
"tester": {"password": "password"}
},
"num_index_replicas":0,
"sync": `
function sync(doc, oldDoc) {
printDebug('New Doc ID: ' + doc._id);
if(isRemoved()){
return;
}
// Add participants if this doc is a conversation
if('conversation' == doc.type){
printDebug('Adding participants to ' + JSON.stringify(doc.channels) + ': ' + JSON.stringify(doc.participants));
access(doc.participants, doc.channels);
}
function isRemoved() {
return (isDelete() && oldDoc == null);
}
function isDelete() {
return (doc._deleted == true);
}
function printDebug(info){
var d = new Date();
console.log('[' + d.toTimeString() + '] ' + info);
}
}
`
}
}
}
Raw Document
{
"channels": "org1035::conv::1",
"participants": [
"org1035-user-0",
"org1035-user-100"
],
"type": "conversation",
}
Meta Data for DocID: org1035::conv::1
{
"meta": {
"id": "org1035::conv::1",
"rev": "51-155ce031a61c00000000000002000006",
"expiration": 0,
"flags": 33554438,
"type": "json"
},
"xattrs": {
"_sync": {
"rev": "22-4cf304b4e0029b8e14b23b15f04b6eaf",
"sequence": 478,
"recent_sequences": [
468,
469,
478
],
"history": {
"revs": [
"4-87acdebc302d6e2bb4cafc5b3bea26d8",
"8-6ca6e826dbf40242fdf941688a723562",
"12-96a70c8c8ebc7bbf8bf14c80deb87c4b",
"21-64b3c122a4050f8da69430af8f64afa9",
"6-c7ac58b394aad5707e973f44bae22005",
"7-47a22e3834c4d470c5eea119b5db5844",
"16-1a6ee904e190c5faa714a7450c20e800",
"15-dcff1e9b8bdf42a6ca369f3619c867ff",
"20-13b872567618595326a3ad99aba02da6",
"5-d52adc3405018645ca6187a4e68056f2",
"1-2136a63ef1a23cbf025cd5d39ba8f396",
"19-0eadd24c115774d96011d776f2936d5f",
"22-4cf304b4e0029b8e14b23b15f04b6eaf",
"10-975608d1d33ea0a3a17c19af30bb2f91",
"18-8914f63d02f7b58c1601cd101344677a",
"2-3baab0172b1da2534e7e87eb7dca13e1",
"9-7a066d338ffc2e6d42681be9c7036958",
"13-ae452a0a2c2d2f447cba183dbbfb877c",
"14-c348591d862b65f0c360b0e7e7edc5d8",
"11-71bfdf4de765410a0bd0e477d1cfe4af",
"3-d51d4ed8ec8bb272837eb4c8b7b576f9",
"17-51be28367c45170b88c57329c323ed7b"
],
"parents": [
20,
5,
19,
8,
9,
4,
7,
18,
11,
0,
-1,
14,
3,
16,
21,
10,
1,
2,
17,
13,
15,
6
],
"channels": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
]
},
"access": {
"org1035-user-0": {
"org1035::conv::1": 4
},
"org1035-user-100": {
"org1035::conv::1": 4
}
},
"cas": "0x00001ca631e05c15",
"value_crc32c": "0xde7bcdc4",
"time_saved": "2018-10-12T13:41:16.497541622Z"
}
}
}