{"id":822,"date":"2012-01-18T12:24:00","date_gmt":"2012-01-18T12:24:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/2012\/10\/morphia-and-mongodb-evolving-document-structures.html"},"modified":"2012-10-21T22:44:33","modified_gmt":"2012-10-21T22:44:33","slug":"morphia-and-mongodb-evolving-document","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html","title":{"rendered":"Morphia and MongoDB: Evolving Document Structures"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left\">In my <a href=\"http:\/\/www.javacodegeeks.com\/2011\/11\/using-mongodb-with-morphia.html\">previous post on Morphia<\/a>, I went through some typical usages and mentioned some caveats and workarounds for known problems. I showed how easy it is to work with Morphia and how cleanly it interacts with the Java world.<\/p>\n<p>To follow up on that post, I\u2019m going to discuss how to deal with some real life needs: handling changing schemas and customizing your mapping to handle things like read-only fields and replacing simple fields with complex objects.<\/p>\n<p><strong>Changing Schemas<\/strong><\/p>\n<p>As nearly anyone who has worked with databases in the development world knows, schemas are always evolving. Fields get deprecated or outright dropped, tables become obsolete, new fields are added, and so on.<\/p>\n<p>While a lot of this pain is avoided by using a schemaless datastore like MongoDB, sometimes we still do need special handling for changes, and in the case of Morphia, we essentially have defined a schema, so we do have to find ways to deal with this. The nice part about it is that Morphia makes it very clean and easier than you\u2019ll see in just about in any ORM.<\/p>\n<p><strong>Deprecating Fields<\/strong><\/p>\n<p>One good example is a deprecated field that has been replaced by another field. Let\u2019s imagine you have a bug tracking system with documents that look something like this:<\/p>\n<pre class=\"brush: java;\">{\r\n  _id:1,\r\n  desc: \"IE Rendering broken on intranet site\",\r\n  componentName: \"INTRANET\",\r\n  dateCreated: ISODate(\"2011-09-06T20:52:50.258Z\")\r\n}\r\n<\/pre>\n<p>Here is the Morphia definition:<\/p>\n<pre class=\"brush: java;\">@Entity(\"issues\")\r\nclass Issue {\r\n  @Id private long id;\r\n  private String desc;\r\n  private String componentName;\r\n\r\n  private Date dateCreated = new Date();\r\n}\r\n<\/pre>\n<p>Now imagine at some point we decide to do away with the <span class=\"Apple-style-span\" style=\"font-family: 'Courier New', Courier, monospace\">component <\/span>field and make it a more generic free text field where users can enter multiple components, versions, or other helpful information. We don\u2019t want to just stick that in the <span class=\"Apple-style-span\" style=\"font-family: 'Courier New', Courier, monospace\">component <\/span>field, as that would lead to confusion.<\/p>\n<p>Thankfully, we have a something in the Morphia toolkit that is made exactly for this \u2013 The <span class=\"Apple-style-span\" style=\"font-family: 'Courier New', Courier, monospace\">@AlsoLoad<\/span> annotation. This annotation allows us to populate a POJO field with one of multiple possible sources. We simply update our Morphia mapping to indicate an old field name, and we can easily remove references to the old field without breaking anything. This keeps our code and documents clean.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush: java;\">@Entity(\"issues\")\r\nclass Issue {\r\n  @Id private long id;\r\n  private String desc;\r\n\r\n  @AlsoLoad(\"componentName\") \/\/ handle old componentName field\r\n  private String affects;\r\n\r\n  private Date dateCreated = new Date();\r\n}\r\n<\/pre>\n<p>So here we\u2019ve defined automatic translation of our old field without any need to update documents or write special logic within our POJO class to handle documents differently depending on when they were created.<\/p>\n<p>One important note: in this example, if both the <span class=\"Apple-style-span\" style=\"font-family: 'Courier New', Courier, monospace\">affects <\/span>field and the old <span class=\"Apple-style-span\" style=\"font-family: 'Courier New', Courier, monospace\">componentName <\/span>field exist, Morphia will throw an exception, so don\u2019t try using this for anything other than deprecating fields, or perhaps populating a single field with two mutually exclusive properties.<\/p>\n<p><strong>Supporting Read-Only for Deprecated Fields<\/strong><\/p>\n<p>Another possibility is that you just have to support an old field in document that the application no longer writes. This is a very simple one: use the <span class=\"Apple-style-span\" style=\"font-family: 'Courier New', Courier, monospace\">@NotSaved<\/span> annotation. When you use this on a field, the data will be loaded but not written by Morphia.<\/p>\n<p>In our previous example, we could just as easily have decided to just support display for the old field but not treat populate it into the affects field, so let\u2019s alter our Morphia POJO a bit to show how <span class=\"Apple-style-span\" style=\"font-family: 'Courier New', Courier, monospace\">@NotSaved<\/span> is used.<\/p>\n<pre class=\"brush: java;\">@Entity(\"issues\")\r\nclass Issue {\r\n  @Id private long id;\r\n  private String desc;\r\n\r\n  private String affects;\r\n\r\n  @NotSaved(\"componentName\") \/\/ load old componentName field for display only\r\n  private String componentName\r\n\r\n  private Date dateCreated = new Date();\r\n}\r\n<\/pre>\n<p><strong>Replacing a Field with An Embedded Object<\/strong><\/p>\n<p>Now what if our <span class=\"Apple-style-span\" style=\"font-family: 'Courier New', Courier, monospace\">componentName<\/span><span class=\"Apple-style-span\" style=\"font-family: 'Courier New', Courier, monospace;font-size: x-small\"> <\/span>field had actually changed to a complex component object which has a name, version and build number? This is a bit trickier since we want to replace one field with multiple. We can\u2019t attempt to load the field from multiple sources since they have different structures. Of course, we can use an embedded object to store the complex component information, but how can we make our code work seamlessly either way without having to update our documents?<\/p>\n<p>In this case, the simplest approach would be to use a combination of three annotations. First we would mark the old field with the <span class=\"Apple-style-span\" style=\"font-family: 'Courier New', Courier, monospace\">@NotSaved<\/span> annotation, introduce a new embedded <span class=\"Apple-style-span\" style=\"font-family: 'Courier New', Courier, monospace\">Component<span class=\"Apple-style-span\" style=\"font-size: x-small\">&nbsp;<\/span><\/span>object using the <span class=\"Apple-style-span\" style=\"font-family: 'Courier New', Courier, monospace\">@Embedded annotation<\/span>, and finally take advantage one more annotation that Morphia provides \u2013 <span class=\"Apple-style-span\" style=\"font-family: 'Courier New', Courier, monospace\">@PostLoad<\/span>. This one lets us have a method that is executed after the POJO is populated from MongoDB.<\/p>\n<p>Here\u2019s the example:<\/p>\n<pre class=\"brush: java;\">@Entity(\"issues\")\r\nclass Issue {\r\n  @Id private long id;\r\n  private String desc;\r\n\r\n  private String affects;\r\n\r\n  @NotSaved(\"componentName\") \/\/ load old componentName to convert to component\r\n  private String componentName\r\n\r\n  @Embedded \/\/ our new complex Component\r\n  private Component component;\r\n\r\n  private Date dateCreated = new Date();\r\n  \/\/ getters and setters ...\r\n\r\n  @PostLoad\r\n  protected void handleComponent() {\r\n      if (component == null &amp;&amp; componentName != null) {\r\n        component = new Component(componentName, null, null);\r\n      }\r\n  }\r\n}\r\n\r\nclass Component {\r\n  private String componentName;\r\n  private Long version;\r\n  private Long buildNumber;\r\n\r\n  public Component(String componentName, Long version, Long buildNumber) {\r\n    \/\/ ...\r\n  }\r\n\r\n  \/\/ getters and setters ...\r\n}\r\n<\/pre>\n<p>In this case, we could remove the getter and setter for the <span class=\"Apple-style-span\" style=\"font-family: 'Courier New', Courier, monospace\">componentName<\/span> field, so that our mapped object only exposes the new and improved interface.<\/p>\n<p><strong>Conclusion<\/strong><\/p>\n<p>By using the powerful tools that Morphia gives us through its annotation support, we can meet these goals:<\/p>\n<ol style=\"text-align: left\">\n<li>Let our document structure adapt with the application and stay clean.<\/li>\n<li>Seamlessly handle changing structure in our Java code without error-prone code.<\/li>\n<li>Expose only the new schema while supporting the old (truly obsolete the old code and fields.<\/li>\n<\/ol>\n<p>Hopefully this helps a few of you out with adapting to evolving documents, or at least to become more familiar with the abilities some of these Morphia annotations give you.<\/p>\n<p><strong><i>References: &nbsp;<\/i><\/strong><a href=\"http:\/\/www.carfey.com\/blog\/evolving-document-structures-with-morphia-and-mongodb\/\">Morphia and MongoDB: Evolving Document Structures<\/a>&nbsp; from our&nbsp;<a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a>&nbsp;Craig Flichel at the&nbsp;<a href=\"http:\/\/www.carfey.com\/blog\/\">Carfey Software Blog<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In my previous post on Morphia, I went through some typical usages and mentioned some caveats and workarounds for known problems. I showed how easy it is to work with Morphia and how cleanly it interacts with the Java world. To follow up on that post, I\u2019m going to discuss how to deal with some &hellip;<\/p>\n","protected":false},"author":59,"featured_media":187,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[112,318],"class_list":["post-822","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-mongodb","tag-morphia"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Morphia and MongoDB: Evolving Document Structures - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In my previous post on Morphia, I went through some typical usages and mentioned some caveats and workarounds for known problems. I showed how easy it is\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Morphia and MongoDB: Evolving Document Structures - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In my previous post on Morphia, I went through some typical usages and mentioned some caveats and workarounds for known problems. I showed how easy it is\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2012-01-18T12:24:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-10-21T22:44:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/mongodb-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Craig Flichel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Craig Flichel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/01\\\/morphia-and-mongodb-evolving-document.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/01\\\/morphia-and-mongodb-evolving-document.html\"},\"author\":{\"name\":\"Craig Flichel\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/c1bcd58320330b548e07d846510f9460\"},\"headline\":\"Morphia and MongoDB: Evolving Document Structures\",\"datePublished\":\"2012-01-18T12:24:00+00:00\",\"dateModified\":\"2012-10-21T22:44:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/01\\\/morphia-and-mongodb-evolving-document.html\"},\"wordCount\":815,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/01\\\/morphia-and-mongodb-evolving-document.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/mongodb-logo.jpg\",\"keywords\":[\"MongoDB\",\"Morphia\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/01\\\/morphia-and-mongodb-evolving-document.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/01\\\/morphia-and-mongodb-evolving-document.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/01\\\/morphia-and-mongodb-evolving-document.html\",\"name\":\"Morphia and MongoDB: Evolving Document Structures - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/01\\\/morphia-and-mongodb-evolving-document.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/01\\\/morphia-and-mongodb-evolving-document.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/mongodb-logo.jpg\",\"datePublished\":\"2012-01-18T12:24:00+00:00\",\"dateModified\":\"2012-10-21T22:44:33+00:00\",\"description\":\"In my previous post on Morphia, I went through some typical usages and mentioned some caveats and workarounds for known problems. I showed how easy it is\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/01\\\/morphia-and-mongodb-evolving-document.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/01\\\/morphia-and-mongodb-evolving-document.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/01\\\/morphia-and-mongodb-evolving-document.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/mongodb-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/mongodb-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/01\\\/morphia-and-mongodb-evolving-document.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Morphia and MongoDB: Evolving Document Structures\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/c1bcd58320330b548e07d846510f9460\",\"name\":\"Craig Flichel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f7ada05eac86c369123683747aa5f714e262e52d4af354efe8aba14f76075dc4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f7ada05eac86c369123683747aa5f714e262e52d4af354efe8aba14f76075dc4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f7ada05eac86c369123683747aa5f714e262e52d4af354efe8aba14f76075dc4?s=96&d=mm&r=g\",\"caption\":\"Craig Flichel\"},\"sameAs\":[\"http:\\\/\\\/www.carfey.com\\\/blog\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Craig-Flichel\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Morphia and MongoDB: Evolving Document Structures - Java Code Geeks","description":"In my previous post on Morphia, I went through some typical usages and mentioned some caveats and workarounds for known problems. I showed how easy it is","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html","og_locale":"en_US","og_type":"article","og_title":"Morphia and MongoDB: Evolving Document Structures - Java Code Geeks","og_description":"In my previous post on Morphia, I went through some typical usages and mentioned some caveats and workarounds for known problems. I showed how easy it is","og_url":"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-01-18T12:24:00+00:00","article_modified_time":"2012-10-21T22:44:33+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/mongodb-logo.jpg","type":"image\/jpeg"}],"author":"Craig Flichel","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Craig Flichel","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html"},"author":{"name":"Craig Flichel","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/c1bcd58320330b548e07d846510f9460"},"headline":"Morphia and MongoDB: Evolving Document Structures","datePublished":"2012-01-18T12:24:00+00:00","dateModified":"2012-10-21T22:44:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html"},"wordCount":815,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/mongodb-logo.jpg","keywords":["MongoDB","Morphia"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html","url":"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html","name":"Morphia and MongoDB: Evolving Document Structures - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/mongodb-logo.jpg","datePublished":"2012-01-18T12:24:00+00:00","dateModified":"2012-10-21T22:44:33+00:00","description":"In my previous post on Morphia, I went through some typical usages and mentioned some caveats and workarounds for known problems. I showed how easy it is","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/mongodb-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/mongodb-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2012\/01\/morphia-and-mongodb-evolving-document.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Morphia and MongoDB: Evolving Document Structures"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/c1bcd58320330b548e07d846510f9460","name":"Craig Flichel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f7ada05eac86c369123683747aa5f714e262e52d4af354efe8aba14f76075dc4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f7ada05eac86c369123683747aa5f714e262e52d4af354efe8aba14f76075dc4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f7ada05eac86c369123683747aa5f714e262e52d4af354efe8aba14f76075dc4?s=96&d=mm&r=g","caption":"Craig Flichel"},"sameAs":["http:\/\/www.carfey.com\/blog\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/Craig-Flichel"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/822","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/59"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=822"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/822\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/187"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=822"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}