I've implemented the sync process based on a coubchbase app developed with phonegap. However, I have some issues when I try to get the changes from the SG.
This is what I did. I created two documents and a user. The app sent the changes to the SG and then to the couchbase server. After that, I removed the app from the phone, installed it again and stopped the SG. When the app started up again, I could see in the SG logs the changes coming from the couchbase server to the SG. The problem came up when the app tried to get the changes from the SG. If I try to see them through the admin interface (SG) I can see them well. However, if I try to get them from the mobile app, I only get one of them, the one related to the user document.
[I think the following is from the sync process between couchbase and sync gateway]
15:11:28.786582 HTTP: #012: GET /adb/_changes?feed=longpoll&heartbeat=1000&style=all_docs&since=0&limit=100&include_docs=true (ADMIN)
15:11:29.030749 changes_view: Query took 243.893437ms to return 2 rows, options = db.Body{"limit":100, "stale":false, "startkey":[]interface {}{"*", 0x1}, "endkey":[]interface {}{"*", 0x4}}
15:11:29.035647 WARNING: Changes feed: error getting doc "_user/fede": 400 Invalid doc ID -- db.(*Database).addDocToChangeEntry() at changes.go:57
15:11:29.035713 HTTP+: #012: --> 200 OK (0.0 ms)
[The following shows the changes retrieved through the admin interface]
15:44:22.054865 HTTP: #038: GET /vdb/_changes?feed=longpoll&heartbeat=1000&style=all_docs&since=0&limit=100&include_docs=true (ADMIN)
15:44:22.138401 WARNING: Changes feed: error getting doc "_user/fede": 400 Invalid doc ID -- db.(*Database).addDocToChangeEntry() at changes.go:57
15:44:22.138459 HTTP+: #038: --> 200 OK (0.0 ms)
[browser's console output]
{
results: [
{
seq: 2,
id: "B14D6B41-DB44-404E-A355-43DDB252A81E",
doc: {
_id: "B14D6B41-DB44-404E-A355-43DDB252A81E",
_rev: "1-0c0ff608417c7a4748215a822b61d2ae",
active: true,
createdAt: "2015-01-08T15:19:24.629Z",
id: "record-158",
modifiedAt: "2015-01-08T15:19:24.629Z",
name: "Thu Jan 08 2015 12:19:20",
type: "event"
},
changes: [
{
rev: "1-0c0ff608417c7a4748215a822b61d2ae"
}
]
},
{
seq: 3,
id: "C4315EBA-1C17-4136-AECE-0D1AF33C10BE",
doc: {
_id: "C4315EBA-1C17-4136-AECE-0D1AF33C10BE",
_rev: "1-f2fc940cb0aab6289228e1ef9884ab3f",
active: true,
createdAt: "2015-01-08T15:19:42.406Z",
id: "record-161",
modifiedAt: "2015-01-08T15:19:42.406Z",
name: "Thu Jan 08 2015 12:19:40",
type: "event"
},
changes: [
{
rev: "1-f2fc940cb0aab6289228e1ef9884ab3f"
}
]
},
{
seq: 4,
id: "_user/fede",
changes: [
{
rev: ""
}
]
}
],
last_seq: "4"
}
[The following shows the changes retrieved from the my app]
15:18:52.892483 HTTP: #020: GET /adb/_changes?feed=longpoll&include_docs=true&conflicts=true&style=all_docs&since=1&limit=100
15:18:52.892575 HTTP: #020: --> 401 Login required (2.3 ms)
15:18:53.495125 HTTP: #021: GET /adb/_changes?feed=longpoll&include_docs=true&conflicts=true&style=all_docs&since=1&limit=100 (as fede)
15:18:53.495422 WARNING: Changes feed: error getting doc "_user/fede": 400 Invalid doc ID -- db.(*Database).addDocToChangeEntry() at changes.go:57
15:18:53.495822 HTTP+: #021: --> 200 OK (0.0 ms)
[browser's console output]
{"results":[{"seq":4,"id":"_user/fede","changes":[]}],"last_seq":"4"}
As it can be seen, the changes attribute is an empty array here. Could anybody tell me why is that and how could I get the same changes that I get through the admin interface? Why are there two HTTP requests to get the changes if the app only makes one?