Ok - so we are taking about the first problem only.

If I try this, then I get not update to the data at all:

function(doc, req) {
    if( doc.type == "profile" ) {
        var newdoc = req.body ;
        var d = new Date();
        newdoc.serverISO8601time = d.toISOString();
        newdoc.serverTime = d.getTime() / 1000 ;
        log( toJSON(newdoc) ) ;
        return [newdoc , "OK"] ;
    }
}

What is wrong here?




On 11/20/2013 03:04 AM, Alexander Shorin wrote:
On Wed, Nov 20, 2013 at 12:01 PM, Vivek Pathak <vpat...@orgmeta.com> wrote:
On 11/20/2013 02:48 AM, Alexander Shorin wrote:
First problem is that your update function works with `doc` argument -
that is the stored within database document -, not that you had sent
with PUT request. To process the request payload you need to work with
req.body data, but in your case this isn't need to.

Second is that both text and timestamp have actually changed - take a
look on them one more time (;

I see "hello 123" in both the text fields.  Not sure what you see as the
change.
Your update function changes only serverISO8601time and serverTime
fields, not any others.

--
,,,^..^,,,

Reply via email to