title: How to handle Sequelize nested/compound queries?
body: <p>I'm a confused how to handle nested <code>WHERE</code>'s using Sequelize. The documentation doesn't really have an example of this. I have a query that looks like this:</p>
  
  <p><code>SELECT * FROM Users WHERE likes &lt;= $likeVariable AND ( likes &lt; $likeVariable OR id &lt; $idVariable ) ORDER BY likes DESC, id DESC</code></p>
  
  <p>I need this query for cursor based pagination on a non-unique property <code>likes</code>, which is why I need the <code>id</code> property suggested <a href="https://dba.stackexchange.com/a/164755">here</a></p>
  
  <p>How do I convert this to my Sequelize query?</p>
  
  <pre><code>var users = await Users.findAndCountAll({
      where: ????, &lt;- How do I do the WHERE clause?
      order: [['likes', 'DESC'], ['id', 'DESC']]
  });
  </code></pre>