Is there a way to have _deleted true and the full document body for a document?

We are using Sync Gateway 1.3.1 and couchbase lite 1.3.1 iOS. We have a situation where a couple documents have the _deleted flag = true, but we also have the full document body in the document. We don’t set the _deleted flag manually, but we do handle conflicts in our couchbase lite iOS code. Any time something is properly deleted the _deleted flag is set, and the document body is removed. Does anyone know if there is a scenario where the _deleted flag can be true and the document body can be present without manually setting the _deleted flag? We only delete things by calling the DELETE method on sync gateway API, or using setIsDeletion method on CBLUnsavedRevision object when resolving conflicts and neither has ever caused this behaviour before.

No, in SG its either GET/PUT/POST/DELETE. so any change in the doc is a new revision.

On the Sync Gateway side, as @househippo says, it shouldn’t happen unless you’re manually creating the doc with "_deleted": true and adding it back with a PUT.

On the Couchbase Lite side, I’d have to check for iOS but I imagine setIsDeletion is adding deleted "_deleted": true to whatever is currently in CBLUnsavedRevision, so if CBLUnsavedRevision had the full properties, so does the revision with "_deleted": true. @jens will probably know this off the top of his head faster than I can doublecheck though :wink: