MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / DeleteDoc

Method DeleteDoc

db/crud.go:3205–3210  ·  view source on GitHub ↗

Deletes a document, by adding a new revision whose _deleted property is true.

(ctx context.Context, docid string, docVersion DocVersion)

Source from the content-addressed store, hash-verified

3203
3204// Deletes a document, by adding a new revision whose _deleted property is true.
3205func (db *DatabaseCollectionWithUser) DeleteDoc(ctx context.Context, docid string, docVersion DocVersion) (string, *Document, error) {
3206 versionKey, versionStr := docVersion.Body1xKVPair()
3207 body := Body{BodyDeleted: true, versionKey: versionStr}
3208 newRevID, doc, err := db.Put(ctx, docid, body)
3209 return newRevID, doc, err
3210}
3211
3212// Purges a document from the bucket (no tombstone)
3213func (db *DatabaseCollectionWithUser) Purge(ctx context.Context, key string, needsAudit bool) error {

Callers 9

DeleteDocumentMethod · 0.45
TestGet1xRevAndChannelsFunction · 0.45
TestGetDeletedFunction · 0.45
TestAllDocsOnlyFunction · 0.45
TestConflictsFunction · 0.45
TestImportCompactPanicFunction · 0.45

Calls 2

PutMethod · 0.95
Body1xKVPairMethod · 0.80

Tested by 9

DeleteDocumentMethod · 0.36
TestGet1xRevAndChannelsFunction · 0.36
TestGetDeletedFunction · 0.36
TestAllDocsOnlyFunction · 0.36
TestConflictsFunction · 0.36
TestImportCompactPanicFunction · 0.36