Chapter 4: Lab Apply the Schema Versioning Pattern

Hi,

I understand this pattern, I have used it. But in this case I don´t understand what is the correct definition to apply to resolve de Lab, because, is mandatory to have the requirement to modify the application to apply the pattern? Because I understand that if I need to have more than one version for a collection then I need to apply this pattern because is one of the cases. Isn´t it? Thanks!

Suggest as a first step, search for and read all the threads related to this lab on the discussion board for this course. It’s been discussed a few times and should aide in your task resolution.

Hi @Veronica_50710,

You are right in explaining about the pattern, this pattern is recommended when we need to have multiple versions.
But I am not sure if I understand your question or confusion, can you please elaborate?

Kanika

Yes, thanks, I reviewed but I´m not sure if the Pattern is clear for me: because I read the sentence “you have to keep documents with different structures in the same collection.” I thought that is the typical case when I have to use a way to mark different versions, although the application have not to be modified…

Veronica,

There is a pattern (Document Versioning Pattern) to use for when you want to explicitly keep many versions of the same documents. For example, let’s say a bank wants to keep track of the latest “conditions and rules” you agreed too, but wants to keep a history of the previous ones they sent you.

The Schema Versioning Pattern is used for when you have only one version of a document, but it may have a different shape than another document in the same collection. It may be OK to have different shapes, as your application can deal with these differences, or it may be a transitional phase where all documents will evolve from shape/version 2 to shape/version 3. That transition may take a fair amount of time and you may want to do the transition without downtime. In this scheme, all documents with “schema_version = 2” will have the exact same shape and forth on.

Let us know if there is still something unclear and thanks for your feedback,
Daniel.

2 Likes