Noticing a DELETE request in the sync function

29 views
Skip to first unread message

Seung Chan Lim

unread,
Feb 20, 2015, 8:04:11 PM2/20/15
to mobile-c...@googlegroups.com
What I'm trying to do is delete a document through the sync gateway. But my sync function won't let me do it for this reason

Sync fn rejected: new=map[_deleted:true _rev:15-663c3c699eed204714085666df9fe784 _id:c493aedaa7ba443489d1784c0e792436]  old={"_deleted":true,"date":["2015-02-20T23:47:19.831580"],"owner":"9078b916ac8b49f789f28818ab0eeef0","request_language":"en","request_type":1002,"type":["Request"]} --> 403 Type must be speficied on all documents.


That 403 is me and my sync function rejecting any document that doesn't have a type. This is purely for my own error checking. But I don't want to bother with this logic if I'm trying to DELETE a document.

Is there a way to notice that what I'm dealing with is a DELETE request in the sync function such that I can bypass this logic?

slim

Seung Chan Lim

unread,
Feb 20, 2015, 8:08:03 PM2/20/15
to mobile-c...@googlegroups.com
Oh wait. I can just check

function (doc, old_doc) {


if (old_doc && doc._deleted) {
} else { // do error checking
}

}

right?

slim

Jens Alfke

unread,
Feb 20, 2015, 9:17:01 PM2/20/15
to mobile-c...@googlegroups.com
Right.

—Jens
Reply all
Reply to author
Forward
0 new messages