Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to view changes in the document that triggered notification? #22417

Closed
derekbekoe opened this issue Jan 15, 2019 — with docs.microsoft.com · 5 comments

Comments

Copy link
Contributor

commented Jan 15, 2019 — with docs.microsoft.com

All sample documentation I've seen regarding Azure Functions just shows that you get what the document looks like after the update.

However, how do I determine what changed in the document to trigger the notification?
Is this not possible?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@TravisCragg-MSFT

This comment has been minimized.

Copy link
Member

commented Jan 15, 2019

@derekbekoe Thanks for the feedback. We are actively investigating and will get back to you soon.

@Mike-Ubezzi-MSFT

This comment has been minimized.

Copy link
Contributor

commented Jan 15, 2019

@derekbekoe Thank you very much for yoru interest in Azure cloud services and CosmosDB. The functionality you are seeking is not quite available just yet: Change feed and different operations:

Today, you see all operations in the change feed. The functionality where you can control change feed, for specific operations such as updates only and not inserts is not yet available. You can add a “soft marker” on the item for updates and filter based on that when processing items in the change feed.

But, there is a concept of soft marker, which should allow you to identify and filter on the updates only. That is the logic you should implement to achieve the same functionality.

@derekbekoe

This comment has been minimized.

Copy link
Contributor Author

commented Jan 15, 2019

Okay thanks for the response. It clears up my question.

for specific operations such as updates only and not inserts is not yet available

This part doesn't make it clear that it's not possible to know what's changed within an updated document. I interpreted it as you will always get both updates and inserts and cannot filter for only updates. Not that when you get a notification, it only returns the current (new) state of the document and not the properties that were changed.

Can you clarify the soft marker approach?
For example:

{"id": "...",
 "curStatus": "pending"}

If curStatus changes from "pending" to "complete", how could a soft marker be used to filter for changes to curStatus?

@ealsur

This comment has been minimized.

Copy link
Contributor

commented Jan 15, 2019

@derekbekoe As Mike mentioned, you cannot tell which part of the document changes in an update (ie get the diff).

I believe the soft marker approach means that, since the feed publishes both inserts and updates in the same manner (currently you cannot tell an insert from an update since you receive the full document), a marker attribute can be used to differentiate which operation is the change coming from.

You can add a new attribute to the doc like operation and set it to insert when the document is created, and update when the document undergoes an update operation (such as ReplaceDocumentAsync).

@derekbekoe

This comment has been minimized.

Copy link
Contributor Author

commented Jan 16, 2019

Got it thanks.
I will close the issue as the original question was answered.

@derekbekoe derekbekoe closed this Jan 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.