title: JSON Schema with dynamic key field in MongoDB
body: <p>Want to have a i18n support for objects stored in mongodb collection</p>
  
  <p>currently our schema is like:</p>
  
  <pre class="lang-js prettyprint-override"><code>{
    _id: "id"
    name: "name"
    localization: [{
      lan: "en-US",
      name: "name_in_english"
    }, {
      lan: "zh-TW",
      name: "name_in_traditional_chinese"
    }]
  }
  </code></pre>
  
  <p>but my thought is that field "lan" is unique, can I just use this field as a key, so the structure would be</p>
  
  <pre class="lang-js prettyprint-override"><code>{
    _id: "id"
    name: "name"
    localization: {
      "en-US": "name_in_english",
      "zh-TW": "name_in_traditional_chinese"
    }
  }
  </code></pre>
  
  <p>which would be neater and easier to parse (just localization[language] would get the value i want for specific language). </p>
  
  <p>But then the question is: Is this a good practice in storing data in MongoDB? And how to pass the json-schema check?</p>