Hi,
How to deal with the Id sequence when you have multiple devices running couchbase lite, all sync with sync gateway, and in a online/offline system ?
Do I have to it myself, or couchbase include something helping ?
Regards,
Steeve
Hi,
How to deal with the Id sequence when you have multiple devices running couchbase lite, all sync with sync gateway, and in a online/offline system ?
Do I have to it myself, or couchbase include something helping ?
Regards,
Steeve
Can you be a bit more specific on your question -
How to deal with the Id sequence
The Couchbase Replication protocol will handle sequence Ids and such for you . You shouldn’t have to worry about it. Of course, you could provide custom conflict resolvers if you want to otherwise the default conflict resolver will apply.
Hi,
When you look at the travel-sample database, you can see that each document has their ID, as a long value. This value is part of the documentID too. for exemple you have the document airline_4, with some keys, one of them is id = 4.
When you add a now airline from a mobile app, how do you choose your id ? If you use your Iphone and your android phone to add a new airline document, how can you obtain the next id, (id=5 in my exemple). And how do you do to know that this ID was reserved on your Iphone app first (for exemple).
Adding the fact that each apps can be used offline, so with sync gateway off, when you start it back after inserting a local document, you will deal with an id collision.
I can invent a solution for exemple in reserving ranges for each mobile apps, so my question is : Is there something provide by couchbase lite 2.0 to do it ?
Regards
Steeve
The travel sample database comes from Couchbase Server. On the server it’s of course easier to assign unique IDs, for example by using the Increment operator.
In a distributed system there are several ways to assign document IDs —