I've been using happily Creating and Reading documents in my Phonegap 
application, following the TodoLite sample using the coax library. However, 
Updating using PUT doesn't seem to have any effect on my documents. I've 
tried a simple example on my device by calling this code added into 
TodoLite, which creates and gets a document, but does not update it:


var doc = {"name":"test doc", "checked":true};

config.db.post(doc, function (err, ok) {
        console.log("POST result: " + JSON.stringify(ok));

        config.db.get(ok.id, function (err, getdoc) {
            console.log("GET doc: " + JSON.stringify(getdoc));

            getdoc.name = "updated name";
            getdoc.checked = !getdoc.checked;
            config.db.put(getdoc._id, getdoc, function (err, putOk) {
               console.log("PUT updated doc response: " + 
JSON.stringify(putOk));
            });
       });
});

The output looks like this:

POST result: 
{"id":"93831e94-7128-4b26-ba47-930eebc9d33b","rev":"1-0bdb6591fa1c0e32565a3f59273ffa7f","ok":true}
GET doc: {"checked":true,"name":"test 
doc","_rev":"1-0bdb6591fa1c0e32565a3f59273ffa7f","_id":"93831e94-7128-4b26-ba47-930eebc9d33b"}
PUT updated doc response: {"checked":true,"name":"test 
doc","_rev":"1-0bdb6591fa1c0e32565a3f59273ffa7f","_id":"93831e94-7128-4b26-ba47-930eebc9d33b"}

So I'm not seeing any Logcat errors besides "authHeader is null" and 
"Unauthorized -- requestCredentials not given or do not match allowed 
credentials" but the document stays the same after attempting to PUT new 
values to it. I've been banging my head against this problem for a few 
days... am I doing something dumb here? 

Couchbase Lite phonegap plugin v 1.0.4
Samsung Charge, Android v 2.3.6  (I will try on more modern phone as well)
Phonegap v4.2.0

Thank you,
Dan

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/941e5438-4370-4ea2-8a7d-3f62dd310979%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to