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
Closed

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

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

Comments

Copy link
Contributor

@derekbekoe derekbekoe 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
Copy link
Member

@TravisCragg-MSFT TravisCragg-MSFT commented Jan 15, 2019

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

Loading

@Mike-Ubezzi-MSFT
Copy link
Contributor

@Mike-Ubezzi-MSFT Mike-Ubezzi-MSFT 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.

Loading

@derekbekoe
Copy link
Contributor Author

@derekbekoe derekbekoe 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?

Loading

@ealsur
Copy link
Contributor

@ealsur ealsur 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).

Loading

@derekbekoe
Copy link
Contributor Author

@derekbekoe derekbekoe commented Jan 16, 2019

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

Loading

@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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants