Discussion:
CBlite + sync gateway + Couchbase server
pierre houlle
2013-11-28 12:54:07 UTC
Permalink
my mobile app use cblite and sync data with couchbase server.

What must I do if I want to develop a web app running on a nodejs server
(for example) and reading/writing the same synced data ?

I can read data from couchbase server on port 8092, but to write data I can
only do that throw sync_gateway on port 4984.

It doesn't look very clean, how can I do otherwise
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/67d9ec79-ab09-4de1-9334-9414099bb57f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
pierre houlle
2013-11-28 15:15:16 UTC
Permalink
Correction :

I can write once throw sync_gateway with PUT
http://xxxxx:4984/mybase/mydoc, if I want to update the document I've got :
{"error":"conflict","reason":"Document exists"}

So I really don't know if it's possible to mix data on mobile app
(couchbase lite) with web app (coucbase server).
Post by pierre houlle
my mobile app use cblite and sync data with couchbase server.
What must I do if I want to develop a web app running on a nodejs server
(for example) and reading/writing the same synced data ?
I can read data from couchbase server on port 8092, but to write data I
can only do that throw sync_gateway on port 4984.
It doesn't look very clean, how can I do otherwise
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/7b310968-d3e3-44dc-8e0c-5bc4ff35f2ba%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Jens Alfke
2013-11-28 19:21:39 UTC
Permalink
On Nov 28, 2013, at 7:15 AM, pierre houlle <pierre2phsk-***@public.gmane.org<mailto:pierre2phsk-***@public.gmane.org>> wrote:

I can write once throw sync_gateway with PUT http://xxxxx:4984/mybase/mydoc, if I want to update the document I've got : {"error":"conflict","reason":"Document exists"}

The gateway API uses multiversion concurrency control (MVCC) for document updates. To update a document you need to provide the revision ID (_rev field) of the revision you’re replacing, and the server will return that 409 error if there’s a mismatch. This catches conflicts due to race conditions where two clients try to update the document at the same time.

The usual procedure for updating is
GET /db/docid
update the JSON properties, leaving “_rev” and “_id” alone
PUT /db/docid
if the response is 409, retry from step 1
It isn’t strictly necessary to do the GET every time, as long as you remember the previous data you PUT (or just the _rev field). But upon a 409 conflict you have to do a GET to catch up with what someone else changed.

We don’t have our own documentation of the API yet, but it’s very close to the CouchDB REST API<http://docs.couchdb.org/en/latest/>.

—Jens
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/6F300978-84D7-45E0-AEBB-5D85EB45A5D7%40couchbase.com.
For more options, visit https://groups.google.com/groups/opt_out.
Frederic Yesid Peña Sánchez
2013-12-06 21:55:40 UTC
Permalink
Post by Jens Alfke
The gateway API uses multiversion concurrency control (MVCC) for document
updates. To update a document you need to provide the revision ID (_rev
field) of the revision you’re replacing, and the server will return that
409 error if there’s a mismatch. This catches conflicts due to race
conditions where two clients try to update the document at the same time.
The usual procedure for updating is
GET /db/docid
update the JSON properties, leaving “_rev” and “_id” alone
PUT /db/docid
if the response is 409, retry from step 1
It isn’t strictly necessary to do the GET every time, as long as you
remember the previous data you PUT (or just the _rev field). But upon a 409
conflict you have to do a GET to catch up with what someone else changed.
Hi, i'm trying to do some mixup with a PHP application and CBL on
iOS/Android , so my question is:

I'm doing the update with '_id & _rev', it's normal that SyncGateway log
says "Added doc "xxx" / "3-xxxxxx" even on update???

Thanks
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/b141e926-4988-47fa-bfc7-25d663b64b46%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Jens Alfke
2013-12-06 22:55:16 UTC
Permalink
On Dec 6, 2013, at 1:55 PM, Frederic Yesid Peña Sánchez <***@gmail.com<mailto:fredericpena-***@public.gmane.org>> wrote:

I'm doing the update with '_id & _rev', it's normal that SyncGateway log says "Added doc "xxx" / "3-xxxxxx" even on update???

Yes; it really means more like “Added revision…”

—Jens
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/3DD81A20-07B6-446E-9F91-80277DD9E587%40couchbase.com.
For more options, visit https://groups.google.com/groups/opt_out.
Frederic Yesid Peña Sánchez
2013-12-06 23:36:36 UTC
Permalink
Thanks, i also figured to make my views ommit "_sync" keys

El viernes, 6 de diciembre de 2013 16:55:40 UTC-5, Frederic Yesid Peña
Post by Frederic Yesid Peña Sánchez
Post by Jens Alfke
The gateway API uses multiversion concurrency control (MVCC) for document
updates. To update a document you need to provide the revision ID (_rev
field) of the revision you’re replacing, and the server will return that
409 error if there’s a mismatch. This catches conflicts due to race
conditions where two clients try to update the document at the same time.
The usual procedure for updating is
GET /db/docid
update the JSON properties, leaving “_rev” and “_id” alone
PUT /db/docid
if the response is 409, retry from step 1
It isn’t strictly necessary to do the GET every time, as long as you
remember the previous data you PUT (or just the _rev field). But upon a 409
conflict you have to do a GET to catch up with what someone else changed.
Hi, i'm trying to do some mixup with a PHP application and CBL on
I'm doing the update with '_id & _rev', it's normal that SyncGateway log
says "Added doc "xxx" / "3-xxxxxx" even on update???
Thanks
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/123b2910-7cb6-4a32-8cf7-078c39d49c91%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Frederic Yesid Peña Sánchez
2013-12-07 00:05:13 UTC
Permalink
One thing i cant figure is how to correctly pass a combined key using the
php api...

$keyTabla = array(Conexion::getDataBaseName(), $this->_tabla, $channelCb);
// Conexion::getCbCnn() is my CouchBase Connection
$consultaActuales = Conexion::getCbCnn()->view("mobile_sync",
"docsbybd_tabla_usuario", array("keys" => array($keyTabla)));

is this correct as $consultaActuales is returning this.

array (
'total_rows' => 112,
'rows' =>
array (
),
)

But querying in CouchBase console gives me plenty of records like this...

{"total_rows":112,"rows":[
{"id":"bd_advisor_bio_col.especialidades.10","key":["bd_advisor_bio_col",
"tb_especialidad","bd_advisor_bio_col-repre"],"value":{"_sync":{"rev":
"8-5cd849c6b68ce24b014c83faa97edabf","sequence":703,"history":{"revs":[
"1-cceba4bd90e12833eb30e3d01abd5698","2-77098e4612bafcb85d5155e87f1cce64",
"3-d82e959606a09788fcaf40fba74e7c89","4-2a608d87500ad004de63b37dfbde0553",
"5-de4701a30d36300c1ccbd3038ea9bced","6-bf7de41ae4e9b3c62f6106b1e0702429",
"7-a85f754d363cc6261074b199a5824fe0","8-5cd849c6b68ce24b014c83faa97edabf"],
"parents":[-1,0,1,2,3,4,5,6],"bodies":["","","","","","","",""],"channels"
:[["bd_advisor_bio_col-todos"],["bd_advisor_bio_col-todos"],[
"bd_advisor_bio_col-todos"],["bd_advisor_bio_col-todos"],[
"bd_advisor_bio_col-todos"],["bd_advisor_bio_col-todos"],[
"bd_advisor_bio_col-todos"],["bd_advisor_bio_col-todos"]]},"channels":{
"bd_advisor_bio_col-todos":null},"access":{"bd_advisor_bio_col-todos":{
"bd_advisor_bio_col-repre":6}}},"abreviatura":"INT","cod_especialidad":"10",
"hash_dispositivo":"1363817094","hash_servidor":"1363817094",
"nombre_especialidad":"MEDICINA INTERNA","pmsync_bd":"bd_advisor_bio_col",
"pmsync_channels":["bd_advisor_bio_col-todos"],"pmsync_usuario":
"bd_advisor_bio_col-repre","type":"tb_especialidad"}}
]
}





El viernes, 6 de diciembre de 2013 18:36:36 UTC-5, Frederic Yesid Peña
Post by Frederic Yesid Peña Sánchez
Thanks, i also figured to make my views ommit "_sync" keys
El viernes, 6 de diciembre de 2013 16:55:40 UTC-5, Frederic Yesid Peña
Post by Frederic Yesid Peña Sánchez
Post by Jens Alfke
The gateway API uses multiversion concurrency control (MVCC) for
document updates. To update a document you need to provide the revision ID
(_rev field) of the revision you’re replacing, and the server will return
that 409 error if there’s a mismatch. This catches conflicts due to race
conditions where two clients try to update the document at the same time.
The usual procedure for updating is
GET /db/docid
update the JSON properties, leaving “_rev” and “_id” alone
PUT /db/docid
if the response is 409, retry from step 1
It isn’t strictly necessary to do the GET every time, as long as you
remember the previous data you PUT (or just the _rev field). But upon a 409
conflict you have to do a GET to catch up with what someone else changed.
Hi, i'm trying to do some mixup with a PHP application and CBL on
I'm doing the update with '_id & _rev', it's normal that SyncGateway log
says "Added doc "xxx" / "3-xxxxxx" even on update???
Thanks
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/bfb5aff4-4af5-4aac-a162-29aadc23c0d0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Jens Alfke
2013-12-07 00:21:02 UTC
Permalink
On Dec 6, 2013, at 4:05 PM, Frederic Yesid Peña Sánchez <***@gmail.com<mailto:fredericpena-***@public.gmane.org>> wrote:

One thing i cant figure is how to correctly pass a combined key using the php api…

What are you connecting to from PHP? Couchbase Mobile? Or the Sync Gateway? Or Couchbase Server itself?

If you’re talking to Couchbase Server you might want to ask on the Couchbase web forums. I’m not sure any of us on this list know the PHP API.

—Jens
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/85DB1FEF-64A7-4A48-A273-3A1B88D82A30%40couchbase.com.
For more options, visit https://groups.google.com/groups/opt_out.
Matt Ingenthron
2013-12-07 01:25:01 UTC
Permalink
From: Jens Alfke <jens-eZVmTAPG3+***@public.gmane.org<mailto:jens-eZVmTAPG3+***@public.gmane.org>>
Reply-To: "mobile-couchbase-/***@public.gmane.org<mailto:mobile-***@googlegroups.com>" <mobile-couchbase-/***@public.gmane.org<mailto:mobile-***@googlegroups.com>>
Date: Friday, December 6, 2013 4:21 PM
To: "mobile-couchbase-/***@public.gmane.org<mailto:mobile-***@googlegroups.com>" <mobile-couchbase-/***@public.gmane.org<mailto:mobile-***@googlegroups.com>>
Subject: Re: CBlite + sync gateway + Couchbase server

If you’re talking to Couchbase Server you might want to ask on the Couchbase web forums. I’m not sure any of us on this list know the PHP API.


I definitely do, but the couchbase-/***@public.gmane.org list is probably best— or the Communities Q&A up there.

Would be good to know what trouble you're hitting!

Matt

--
Matt Ingenthron
Couchbase, Inc.
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/CEC7B8C0.96B3D%25matt%40couchbase.com.
For more options, visit https://groups.google.com/groups/opt_out.
Brett Lawson
2013-12-07 02:32:13 UTC
Permalink
Hey Frederic,

Can you try to execute viewGenQuery instead and let me know what it
returns? That should make it fairly clear where the issue lies.

Cheers, Brett

On Friday, December 6, 2013 8:05:13 PM UTC-4, Frederic Yesid Peña Sánchez
Post by Frederic Yesid Peña Sánchez
One thing i cant figure is how to correctly pass a combined key using the
php api...
$keyTabla = array(Conexion::getDataBaseName(), $this->_tabla, $channelCb);
// Conexion::getCbCnn() is my CouchBase Connection
$consultaActuales = Conexion::getCbCnn()->view("mobile_sync",
"docsbybd_tabla_usuario", array("keys" => array($keyTabla)));
is this correct as $consultaActuales is returning this.
array (
'total_rows' => 112,
'rows' =>
array (
),
)
But querying in CouchBase console gives me plenty of records like this...
{"total_rows":112,"rows":[
{"id":"bd_advisor_bio_col.especialidades.10","key":["bd_advisor_bio_col",
"8-5cd849c6b68ce24b014c83faa97edabf","sequence":703,"history":{"revs":[
"1-cceba4bd90e12833eb30e3d01abd5698","2-77098e4612bafcb85d5155e87f1cce64",
"3-d82e959606a09788fcaf40fba74e7c89","4-2a608d87500ad004de63b37dfbde0553",
"5-de4701a30d36300c1ccbd3038ea9bced","6-bf7de41ae4e9b3c62f6106b1e0702429",
"7-a85f754d363cc6261074b199a5824fe0","8-5cd849c6b68ce24b014c83faa97edabf"
],"parents":[-1,0,1,2,3,4,5,6],"bodies":["","","","","","","",""],
"channels":[["bd_advisor_bio_col-todos"],["bd_advisor_bio_col-todos"],[
"bd_advisor_bio_col-todos"],["bd_advisor_bio_col-todos"],[
"bd_advisor_bio_col-todos"],["bd_advisor_bio_col-todos"],[
"bd_advisor_bio_col-todos"],["bd_advisor_bio_col-todos"]]},"channels":{
"bd_advisor_bio_col-todos":null},"access":{"bd_advisor_bio_col-todos":{
"10","hash_dispositivo":"1363817094","hash_servidor":"1363817094",
"nombre_especialidad":"MEDICINA INTERNA","pmsync_bd":"bd_advisor_bio_col",
"bd_advisor_bio_col-repre","type":"tb_especialidad"}}
]
}
El viernes, 6 de diciembre de 2013 18:36:36 UTC-5, Frederic Yesid Peña
Post by Frederic Yesid Peña Sánchez
Thanks, i also figured to make my views ommit "_sync" keys
El viernes, 6 de diciembre de 2013 16:55:40 UTC-5, Frederic Yesid Peña
Post by Frederic Yesid Peña Sánchez
Post by Jens Alfke
The gateway API uses multiversion concurrency control (MVCC) for
document updates. To update a document you need to provide the revision ID
(_rev field) of the revision you’re replacing, and the server will return
that 409 error if there’s a mismatch. This catches conflicts due to race
conditions where two clients try to update the document at the same time.
The usual procedure for updating is
GET /db/docid
update the JSON properties, leaving “_rev” and “_id” alone
PUT /db/docid
if the response is 409, retry from step 1
It isn’t strictly necessary to do the GET every time, as long as you
remember the previous data you PUT (or just the _rev field). But upon a 409
conflict you have to do a GET to catch up with what someone else changed.
Hi, i'm trying to do some mixup with a PHP application and CBL on
I'm doing the update with '_id & _rev', it's normal that SyncGateway log
says "Added doc "xxx" / "3-xxxxxx" even on update???
Thanks
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/949a78a7-3f0b-4e81-aa3c-a8e787e1d941%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Frederic Yesid Peña Sánchez
2013-12-11 00:18:44 UTC
Permalink
Hi Brett

Your answer gave to me clear sight of what was happening, a wrong naming
between my generated views and my expected keys.

Now i have a little question about syncing.

The syncing will occur during app backgrounding, or also can happen while
my app is in foreground??

Because my app is not syncing until i minimize and show it again.
Post by Brett Lawson
Hey Frederic,
Can you try to execute viewGenQuery instead and let me know what it
returns? That should make it fairly clear where the issue lies.
Cheers, Brett
On Friday, December 6, 2013 8:05:13 PM UTC-4, Frederic Yesid Peña Sánchez
Post by Frederic Yesid Peña Sánchez
One thing i cant figure is how to correctly pass a combined key using the
php api...
$keyTabla = array(Conexion::getDataBaseName(), $this->_tabla, $channelCb
);
// Conexion::getCbCnn() is my CouchBase Connection
$consultaActuales = Conexion::getCbCnn()->view("mobile_sync",
"docsbybd_tabla_usuario", array("keys" => array($keyTabla)));
is this correct as $consultaActuales is returning this.
array (
'total_rows' => 112,
'rows' =>
array (
),
)
But querying in CouchBase console gives me plenty of records like this...
{"total_rows":112,"rows":[
{"id":"bd_advisor_bio_col.especialidades.10","key":["bd_advisor_bio_col",
"8-5cd849c6b68ce24b014c83faa97edabf","sequence":703,"history":{"revs":[
"1-cceba4bd90e12833eb30e3d01abd5698","2-77098e4612bafcb85d5155e87f1cce64"
,"3-d82e959606a09788fcaf40fba74e7c89",
"4-2a608d87500ad004de63b37dfbde0553","5-de4701a30d36300c1ccbd3038ea9bced"
,"6-bf7de41ae4e9b3c62f6106b1e0702429",
"7-a85f754d363cc6261074b199a5824fe0","8-5cd849c6b68ce24b014c83faa97edabf"
],"parents":[-1,0,1,2,3,4,5,6],"bodies":["","","","","","","",""],
"channels":[["bd_advisor_bio_col-todos"],["bd_advisor_bio_col-todos"],[
"bd_advisor_bio_col-todos"],["bd_advisor_bio_col-todos"],[
"bd_advisor_bio_col-todos"],["bd_advisor_bio_col-todos"],[
"bd_advisor_bio_col-todos"],["bd_advisor_bio_col-todos"]]},"channels":{
"bd_advisor_bio_col-todos":null},"access":{"bd_advisor_bio_col-todos":{
"10","hash_dispositivo":"1363817094","hash_servidor":"1363817094",
"nombre_especialidad":"MEDICINA INTERNA","pmsync_bd":"bd_advisor_bio_col"
"bd_advisor_bio_col-repre","type":"tb_especialidad"}}
]
}
El viernes, 6 de diciembre de 2013 18:36:36 UTC-5, Frederic Yesid Peña
Post by Frederic Yesid Peña Sánchez
Thanks, i also figured to make my views ommit "_sync" keys
El viernes, 6 de diciembre de 2013 16:55:40 UTC-5, Frederic Yesid Peña
Post by Frederic Yesid Peña Sánchez
Post by Jens Alfke
The gateway API uses multiversion concurrency control (MVCC) for
document updates. To update a document you need to provide the revision ID
(_rev field) of the revision you’re replacing, and the server will return
that 409 error if there’s a mismatch. This catches conflicts due to race
conditions where two clients try to update the document at the same time.
The usual procedure for updating is
GET /db/docid
update the JSON properties, leaving “_rev” and “_id” alone
PUT /db/docid
if the response is 409, retry from step 1
It isn’t strictly necessary to do the GET every time, as long as you
remember the previous data you PUT (or just the _rev field). But upon a 409
conflict you have to do a GET to catch up with what someone else changed.
Hi, i'm trying to do some mixup with a PHP application and CBL on
I'm doing the update with '_id & _rev', it's normal that SyncGateway
log says "Added doc "xxx" / "3-xxxxxx" even on update???
Thanks
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/fdf9282a-18c7-4233-ac64-285413fd562b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Frederic Yesid Peña Sánchez
2013-12-11 11:57:46 UTC
Permalink
Hi

Don't worry I figured it out.

My router has outages so my WiFi signal is failing and ovbiously the
replication detected the failure and stalled.

Now I'm just wondering if there is some way to trigger an external command
on sync complete?

I need to trigger a php command that synced mysql and cb.
El dic 10, 2013 7:18 PM, "Frederic Yesid Peña Sánchez" <
Post by Frederic Yesid Peña Sánchez
Hi Brett
Your answer gave to me clear sight of what was happening, a wrong naming
between my generated views and my expected keys.
Now i have a little question about syncing.
The syncing will occur during app backgrounding, or also can happen while
my app is in foreground??
Because my app is not syncing until i minimize and show it again.
Post by Brett Lawson
Hey Frederic,
Can you try to execute viewGenQuery instead and let me know what it
returns? That should make it fairly clear where the issue lies.
Cheers, Brett
On Friday, December 6, 2013 8:05:13 PM UTC-4, Frederic Yesid Peña Sánchez
Post by Frederic Yesid Peña Sánchez
One thing i cant figure is how to correctly pass a combined key using
the php api...
$keyTabla = array(Conexion::getDataBaseName(), $this->_tabla, $channelCb
);
// Conexion::getCbCnn() is my CouchBase Connection
$consultaActuales = Conexion::getCbCnn()->view("mobile_sync",
"docsbybd_tabla_usuario", array("keys" => array($keyTabla)));
is this correct as $consultaActuales is returning this.
array (
'total_rows' => 112,
'rows' =>
array (
),
)
But querying in CouchBase console gives me plenty of records like this...
{"total_rows":112,"rows":[
{"id":"bd_advisor_bio_col.especialidades.10","key":["bd_advisor_bio_col"
"8-5cd849c6b68ce24b014c83faa97edabf","sequence":703,"history":{"revs":[
"1-cceba4bd90e12833eb30e3d01abd5698","2-77098e4612bafcb85d5155e87f1cce
64","3-d82e959606a09788fcaf40fba74e7c89","4-
2a608d87500ad004de63b37dfbde0553","5-de4701a30d36300c1ccbd3038ea9bced",
"6-bf7de41ae4e9b3c62f6106b1e0702429","7-a85f754d363cc6261074b199a5824f
e0","8-5cd849c6b68ce24b014c83faa97edabf"],"parents":[-1,0,1,2,3,4,5,6],
"bodies":["","","","","","","",""],"channels":[["bd_
advisor_bio_col-todos"],["bd_advisor_bio_col-todos"],["bd_
advisor_bio_col-todos"],["bd_advisor_bio_col-todos"],["bd_
advisor_bio_col-todos"],["bd_advisor_bio_col-todos"],["bd_
advisor_bio_col-todos"],["bd_advisor_bio_col-todos"]]},"channels":{
"bd_advisor_bio_col-todos":null},"access":{"bd_advisor_bio_col-todos":{"
"10","hash_dispositivo":"1363817094","hash_servidor":"1363817094","
nombre_especialidad":"MEDICINA INTERNA","pmsync_bd":"bd_advisor_bio_col"
,"pmsync_channels":["bd_advisor_bio_col-todos"],"pmsync_usuario":"
bd_advisor_bio_col-repre","type":"tb_especialidad"}}
]
}
El viernes, 6 de diciembre de 2013 18:36:36 UTC-5, Frederic Yesid Peña
Post by Frederic Yesid Peña Sánchez
Thanks, i also figured to make my views ommit "_sync" keys
El viernes, 6 de diciembre de 2013 16:55:40 UTC-5, Frederic Yesid Peña
Post by Frederic Yesid Peña Sánchez
Post by Jens Alfke
The gateway API uses multiversion concurrency control (MVCC) for
document updates. To update a document you need to provide the revision ID
(_rev field) of the revision you’re replacing, and the server will return
that 409 error if there’s a mismatch. This catches conflicts due to race
conditions where two clients try to update the document at the same time.
The usual procedure for updating is
GET /db/docid
update the JSON properties, leaving “_rev” and “_id” alone
PUT /db/docid
if the response is 409, retry from step 1
It isn’t strictly necessary to do the GET every time, as long as you
remember the previous data you PUT (or just the _rev field). But upon a 409
conflict you have to do a GET to catch up with what someone else changed.
Hi, i'm trying to do some mixup with a PHP application and CBL on
I'm doing the update with '_id & _rev', it's normal that SyncGateway
log says "Added doc "xxx" / "3-xxxxxx" even on update???
Thanks
--
You received this message because you are subscribed to a topic in the
Google Groups "Couchbase Mobile" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/mobile-couchbase/PdG8qxTDcWI/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to
To view this discussion on the web visit
https://groups.google.com/d/msgid/mobile-couchbase/fdf9282a-18c7-4233-ac64-285413fd562b%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/CAD0KcgUgs7eRoCp_u-j_SETH%2BBRSHuX-WZZfkN_CpHqEYP99aQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
Jens Alfke
2013-12-11 14:52:13 UTC
Permalink
Now I'm just wondering if there is some way to trigger an external command on sync complete?
I need to trigger a php command that synced mysql and cb.
An external command where? It sounds like you mean on the server — no, the server doesn’t know anything about replication progress. It just sees groups of incoming POSTs from clients containing new revisions.

—Jens
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/0F4A7424-1B08-4277-8604-CB8EEA0EE733%40couchbase.com.
For more options, visit https://groups.google.com/groups/opt_out.
Frederic Yesid Peña Sánchez
2013-12-11 14:59:05 UTC
Permalink
Yes, i need to trigger something on server after each post batch
On Dec 11, 2013, at 3:57 AM, Frederic Yesid Peña Sánchez <
Post by Frederic Yesid Peña Sánchez
Now I'm just wondering if there is some way to trigger an external
command on sync complete?
Post by Frederic Yesid Peña Sánchez
I need to trigger a php command that synced mysql and cb.
An external command where? It sounds like you mean on the server — no, the
server doesn’t know anything about replication progress. It just sees
groups of incoming POSTs from clients containing new revisions.
—Jens
--
You received this message because you are subscribed to a topic in the
Google Groups "Couchbase Mobile" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/mobile-couchbase/PdG8qxTDcWI/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to
To view this discussion on the web visit
https://groups.google.com/d/msgid/mobile-couchbase/0F4A7424-1B08-4277-8604-CB8EEA0EE733%40couchbase.com
.
For more options, visit https://groups.google.com/groups/opt_out.
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/CAD0KcgXaVP2QmRN-zkm2pek9ennP9YqPGjAs66RnLvr46CMW%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
Jens Alfke
2013-12-11 15:32:33 UTC
Permalink
On Dec 11, 2013, at 6:59 AM, Frederic Yesid Peña Sánchez <***@gmail.com<mailto:fredericpena-***@public.gmane.org>> wrote:

Yes, i need to trigger something on server after each post batch

Use the CouchDB “_changes feed<http://docs.couchdb.org/en/latest/api/database/changes.html>” API, in continuous mode, to get a stream of change notifications from the gateway. (If you’re using a CouchDB wrapper library it probably has its own API for getting such notifications.)

But as I said, you can’t tell when a replication is complete, or even which changes correspond to which client replication. You just see the documents changing one by one.

—Jens
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/2FF64C8B-01AC-4C5B-AEDB-942E41BF338D%40couchbase.com.
For more options, visit https://groups.google.com/groups/opt_out.
Frederic Yesid Peña Sánchez
2013-12-11 16:24:24 UTC
Permalink
Well.. I will stick to my cron script.

Thanks !!!
Post by Jens Alfke
On Dec 11, 2013, at 6:59 AM, Frederic Yesid Peña Sánchez <
Yes, i need to trigger something on server after each post batch
Use the CouchDB “_changes feed<http://docs.couchdb.org/en/latest/api/database/changes.html>”
API, in continuous mode, to get a stream of change notifications from the
gateway. (If you’re using a CouchDB wrapper library it probably has its own
API for getting such notifications.)
But as I said, you can’t tell when a replication is complete, or even
which changes correspond to which client replication. You just see the
documents changing one by one.
—Jens
--
You received this message because you are subscribed to a topic in the
Google Groups "Couchbase Mobile" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/mobile-couchbase/PdG8qxTDcWI/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to
To view this discussion on the web visit
https://groups.google.com/d/msgid/mobile-couchbase/2FF64C8B-01AC-4C5B-AEDB-942E41BF338D%40couchbase.com
.
For more options, visit https://groups.google.com/groups/opt_out.
--
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 mobile-couchbase+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/CAD0KcgU9kBa8%3DXtUUGy7gNLNXPBHRk_4nzwu6CJ1z2POSWYuZA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
Loading...