Chris Rosa
Chris Rosa

Reputation: 43

DocumentDb Change Feed event type?

Is there a way to determine the operation (add/update/delete) that produced change feed entry?

My tests are running using the example provided here but I've been unsuccessful identifying the originating action.

Upvotes: 1

Views: 312

Answers (1)

Aravind Krishna R.
Aravind Krishna R.

Reputation: 8003

To distinguish between creates and updates, you can add a version number for your document. That way, document creates in the change feed will have version = 1, but updates will be 2 or higher.

To track deletes, the best approach is to use DocumentDB's TTL capability. That is, you mark documents with TTL = saym 1 hour. Then you can treat all documents with TTL value set in the change feed as deletes.

Upvotes: 3

Related Questions