title: How to fetch data in the same order as the order of the items in the array using Sequelize
body: <p>For example if the array <code>surveyIdsArr</code> is passed in with the following items in it.</p>
  <pre class="lang-js prettyprint-override"><code>surveyIdsArr = [
    'ac9d491d-9998-4866-956d-9d3107aa341d',
    'f71cfa71-ad1a-40dc-ad19-7f799fef0a31',
    'a9606715-c865-4f99-9afc-48b79af77caa',
    'f22c221d-2052-45af-a1ba-9774ac524a1c',
    '33c47cdb-8a66-45a8-a8ff-cc60de6ce9fc'
  ]
  </code></pre>
  <p><strong>Then how to fetch the data in the same order as the elements in the array</strong></p>
  <p>Right now i am getting elements <code>33c47cdb-8a66-45a8-a8ff-cc60de6ce9fc</code> , <code>22c221d-2052-45af-a1ba-9774ac524a1c</code>, <code>f71cfa71-ad1a-40dc-ad19-7f799fef0a31</code> and like this</p>
  <p>I am using sequelize as the ORM</p>
  <p>Following is the code to fetch the data</p>
  <pre class="lang-js prettyprint-override"><code>let fetchedSurveys = await Survey.findAndCountAll({
        where: {
          id: {
            [Op.in]: surveyIdsArr,
          },
        },
        include: [
          {
            model: User,
            as: &quot;owner&quot;,
          },
          {
            model: Tag,
            as: &quot;tags&quot;,
            attributes: [&quot;id&quot;, &quot;tagName&quot;],
            
          },
        ],
        // helpful in lazy fetching
        offset: offset,
        limit: limit,
        distinct: true,
        col: &quot;id&quot;,
      });
  </code></pre>