> On Sep 23, 2014, at 1:05 PM, MobDev <[email protected]> wrote: > > Can someone help me in understanding how updating works? > • save on Model > • update on Document > • putProperties on Document
Have you read the documentation on these methods? It has examples of using them. http://developer.couchbase.com/mobile/develop/guides/couchbase-lite/native-api/model/index.html#saving http://developer.couchbase.com/mobile/develop/guides/couchbase-lite/native-api/document/index.html#updating > I don't want to change objects in do-while loop, am I missing anything? As part of a distributed system, Couchbase Lite doesn't support record locking or transactions. So a read-modify-write operation can have race conditions, if something else changes the document in between the read and the write. That's why the while loop is necessary — to retry the update if the document's been updated. I agree that the loop is awkward. That's the reason for the -update: method, which encapsulates it for you. You just have to provide the block that updates the properties. > model does have valid document and I am not getting any error on update. If you've got a model, you should be updating it by calling -save:. You don't need to work with the document directly. —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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/9711DB9D-9A25-4074-8E68-77FEC3E01016%40couchbase.com. For more options, visit https://groups.google.com/d/optout.
