title: How can I sort by a nested JSONB attribute in sequelize
body: <p>I want to sort a sequelize query by a nested attribute of a JSONB object.</p>
  
  <p>I have a model like that:</p>
  
  <pre><code>sequelize.define('product', {
      available: { type: Sequelize.BOOLEAN },
      price: { type: Sequelize.JSONB },
      ...
  }
  </code></pre>
  
  <p>where price is kind of this:</p>
  
  <pre><code>price = {
      EUR: 1.2,
      CHF: 1.3,
  }
  </code></pre>
  
  <p>I want to sort a findAll query by price.EUR. I hoped that this works:</p>
  
  <pre><code>product.findAll({ where: { available: true }, order: [['price.EUR', 'ASC']] }
  </code></pre>
  
  <p>But I get an unsorted array.</p>
  
  <p>The underlying DB is postgres.</p>
  
  <p>A solution is to sort the result programmatically in javascript (array._prototype.sort()). But I wonder if it is possible with a sequelize query.</p>