On Wednesday, January 7, 2015 3:36:05 PM UTC-3, Dominique Legault wrote:
>
> Federico, in the changes REST API there is a since parameter to get 
> changes from a specific update sequence. when you get the db from the sync 
> gateway it returns the current update_seq document like so :
> http -auth username:password https://myurl.com:4984/testdb/
> {
>     "committed_update_seq": 3745, 
>     "compact_running": false, 
>     "db_name": "testdb", 
>     "disk_format_version": 0, 
>     "instance_start_time": 1420650337223095, 
>     "purge_seq": 0, 
>     "update_seq": 3745
> }
>
> then pass the update_seq number to the changes API as the since parameter 
> and you will only get new changes.
>
> I have made significant changes to the example phonegap app if your 
> looking for another example of how things are done you can check out my app:
>
> https://github.com/deefactorial/openmoney-mobile/
>
> you can download the app from the google play store by joining my google 
> group.
> https://groups.google.com/forum/#!forum/openmoney-development
>
>
Thanks for the example Dominique.

I've implemented the sync process based on your example. However, I still 
have some issues. I created two document and a user. The app sent the 
changes to the sync manager and then to the couchbase server. Now, I 
removed the app, installed it again and stopped the sync gateway. The app 
started up and I could see in the logs the changes coming from the 
couchbase server to the sync gateway, but the problem came up in this step. 
If I try to see the changes 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.

Here I copy the logs from SG:

[I think the following is from the sync 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)
2015/01/08 15:11:29 go-couchbase: call to ViewCustom("sync_gateway", 
"channels") in 
github.com/couchbaselabs/sync_gateway/base.couchbaseBucket.ViewCustom took 
243.772833ms
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)

{
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)

{"results":[{"seq":4,"id":"_user/fede","changes":[]}],"last_seq":"4"}


As you can see, the changes attribute is an empty array here. Could you 
tell me why is that and how could I get the same changes that I get through 
the admin interface?

Thanks in advance,

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/bc4bf46f-bd2f-47fe-950d-f0dc570bde79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to