How can we improve Azure Cosmos DB?

Support Document Versioning

The ability to generate links to a previous version of a document would be a powerful addition DocumentDB that has many use cases.

In my case I need a self managed profile document that needs to be referenced at point in time to be tied to an event.

739 votes
Vote
Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
You have left! (?) (thinking…)
Philip Coupar shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

Azure Cosmos DB now provides the ability to access the change feed (https://docs.microsoft.com/en-us/azure/cosmos-db/change-feed). A common pattern to implement eventing patterns is

1. Store every version/change as a separate item
2. Read the change feed to merge/consolidate changes and trigger appropriate actions downstream.

You can also expire old versions using TTL: https://docs.microsoft.com/en-us/azure/cosmos-db/time-to-live

10 comments

Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
Submitting...
An error occurred while saving the comment
  • Joel Oughton commented  ·   ·  Flag as inappropriate

    If you're using .NET you can also use Nebula. It implements a simplified versioning pattern over the top of the Cosmos DB SDK. You get versioned read/write consistency for entities with a simple version identifier. This gives you un-delete, restore to previous version etc out of the box without needing to use change feed support directly.

    https://github.com/cloud-maker-ai/Nebula

    Disclaimer: I'm the author.

  • Daniel commented  ·   ·  Flag as inappropriate

    How do I even distinguish between an insert or update? I only need documents that were updated.

  • Stan Spotts commented  ·   ·  Flag as inappropriate

    "Only the most recent change for a given item is included in the change log. Intermediate changes may not be available."

    Doesn't this make change feed useless for true versioning? One or more changes may not appear in the change log as distinct versions, no?

  • Anonymous commented  ·   ·  Flag as inappropriate

    Support to get the previous version of the document in change feed.
    This would be handy if the business logic requires comparison with the previous values and execute a specific logic.

  • Dylan commented  ·   ·  Flag as inappropriate

    This would also allow documentDb to be used as an event store. If we could get a feed per document in combination it would be ideal.
    e.g. I subscribe to document JoeSmith. I get notified when the document has changed with it's version number. I can easily call the previous version to see what has changed

  • Michael Belton commented  ·   ·  Flag as inappropriate

    It would be nice if we can keep track of changed key values linked to original active document rather than storing entire changed document.
    Also publish some feeds for each action with minimum document details.

  • Anand Chalatt commented  ·   ·  Flag as inappropriate

    We would like to see the out of the box document versioning support with DocumentDB. This will enable to keep multiple versions of the same document within Azure Document DB.

  • Cloudy Media commented  ·   ·  Flag as inappropriate

    There can a mode DB mode where Update is append only and deletes are indicated by a tombstone. All versions of the document will naturally be available in this mode.

Feedback and Knowledge Base