title: Postgresql query for objects in nested JSONB field
body: <p>I am using PostgreSQL 9.6, and I have a table named  "ItemDbModel" with two columns looks like:</p>
  
  <pre><code>No integer,
  Content jsonb
  </code></pre>
  
  <p>Say I put many records like:</p>
  
  <pre><code> "No": 2, {"obj":"x","Item": {"Name": "BigDog", "Model": "NamedHusky", "Spec":"red dog"}}
   "No": 4, {"obj":"x","Item": {"Name": "MidDog", "Model": "NamedPeppy", "Spec":"no hair"}}
   "No": 5, {"obj":"x","Item": {"Name": "BigCat", "Model": "TomCat", "Spec":"blue color"}}
  </code></pre>
  
  <p>How can I query the table for:</p>
  
  <ol>
  <li>Records where "Content.Item.Name" contains "Dog" <strong>And</strong> "Content.Item.Spec" contains "red".</li>
  <li>Records where "Content.Item.Name" contains "Dog" <strong>OR</strong> "Content.Item.Spec" contains "red".</li>
  <li>Records where <strong>Any</strong> json fields in "Content.Item" contains "dog".</li>
  </ol>
  
  <p>And order by "Content.Item.Name.length"?</p>
  
  <p>Thank you!</p>