Cannot download existing json from CB server to CBL after CB version upgrade


#1

Hi all,

I’ve an existing web project is using Couchbase server as a DB which running almost 1 year.

Last month, I just finished the version upgrade for CB and SG and everything running very well.

  • From Couchbase 4.6 to 5.5
  • From Sync Gateway 1.4 to 2.0

However, when I build a new iOS app and do the data sync, I cannot download full set of json document from couchbase server.

**_json file failed to download **
Json files created in old version of CB 4.6 and SG 1.4

**_json file success to download **
Json file created in new version CB 5.5 and SG 2.0

After some testing and research, I noticed that if the json file created in old CB version with object attached which may impact the data sync after version upgrade, it look like related to the new feature “XATTS”.

Below is the sync gateway config file for reference,

{
“log”: [
“CRUD”,
“CRUD+”,
“HTTP”,
“HTTP+”,
“Access”,
“Cache”,
“Shadow”,
“Shadow+”,
“Changes”,
“Changes+”
],
“interface”: “:4984”,
“adminInterface”: “:4985”,
“databases”: {
“testing”: {
“users”: {
“GUEST”: {
“disabled”: false,
“admin_channels”: ["*"]
}
},
“roles”: {
“admin”: {},
“user”: {}
},
“server”: “XXXXX”,
“bucket”: “XXXXX”,
“enable_shared_bucket_access”: true,
“import_docs”: “true”,
“sync”:
function(doc, oldDoc){ XXXX }
}
}
}

Can anyone help how can I download an existing documents to mobile app after the version upgrade?


#2

Try import_docs “continuous” instead of true.


#3

Thank you for your prompt response

I’ve tried your suggestion to change the import_docs “continuous” instead of true, but it still doesn’t work.


#4

This is an error returned in sync gateway


#5

more information

The json document can be downloaded to mobile App if I remove the "_attachments” object.

{

"_attachments": {

"doc": {

"content_type": "application/pdf",

"digest": "sha1-r7FOZjGbqB1wfLpNthYYZl/UV6s=",

"length": 850059,

"revpos": 10,

"stub": true

}

},

"_id": "000000-00001",

"_rev": "2-00807633770106802e4836891ec223ce",

"field_1": "abc",

"field_2": "def",

}


#6

@kelvin.wong The SG log errors don’t look directly related to the document you shared (i.e. the digest of the attachment being retrieved doesn’t match).

What version of Couchbase Lite are you using?


#7

Couchbase Lite 1.4 and the json doc what I shared is an example for your reference (Same error return for this json SG log)


#9

I found a related post which can solved the issue by delete and add the document again. but this is not possible to do in production as there are huge number of documents insidecouchbase server already.