title: How to get all records from the last 7 days sequelize
body: <p>I am trying to get all records from a mysql Database with sequelize and I have tried following approaches:</p>
  
  <pre><code>shops.findAndCountAll({
    where: {
      createdAt: {
        [Op.gte]: moment().subtract(7, 'days').toDate()
      }
    }
  })
  </code></pre>
  
  <p>and when I use this, I get the error:
  <code>ReferenceError: moment is not defined</code></p>
  
  <p>So I tried this approach:</p>
  
  <pre><code>shops.findAndCountAll({
    where: {
      createdAt: {
        [Op.gte]: Sequelize.literal('NOW() - INTERVAL "7d"'),
      }
    }
  })
  </code></pre>
  
  <p>But I get the following error</p>
  
  <pre><code>code: 'ER_PARSE_ERROR',
      errno: 1064,
      sqlState: '42000',
      sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to 
  
  your MySQL server version for the right syntax to use near '' at line 1",
          sql: "SELECT count(*) AS `count` FROM `shop` AS `shops` WHERE `shops`.`createdAt` &gt;= NOW() - INTERVAL '7d';"
        },
        sql: "SELECT count(*) AS `count` FROM `shop` AS `shops` WHERE `shops`.`createdAt` &gt;= NOW() - INTERVAL '7d';"
      }
  </code></pre>
  
  <p>How can I fix this issue. I do not mind which of the approaches I use, as long as I get it to work.</p>
  
  <p>Thank you in advance</p>