title: MongoDB - How to construct a find with input array like this
body: <p>I'm a beginner MongoDB developer and I'm having trouble constructing this <code>.find()</code> statement.</p>
  <p>Problem:</p>
  <ul>
  <li>I have a list of Bus Stop Codes and I am looking to query the database for detailed information on these Bus Stops for a Bus Route App API</li>
  </ul>
  <p>Example:</p>
  <ul>
  <li>I have an array of Bus Stop Codes <code>[1, 4, 5, 3, 1]</code>. I need to return an array of objects from the bus stop that matches these Bus Stop Codes.</li>
  </ul>
  <p>The end product has to be:</p>
  <ol>
  <li>In the same order as the order in the array</li>
  <li>Include duplicates (the array starts and ends at the same bus stop, and I must retrieve both the start and the end as two separate bus stops in the resulting object).</li>
  </ol>
  <p>So far, I have tried</p>
  <pre><code>.find( StopCode: {$in: [1, 4, 5, 3, 1]})
  </code></pre>
  <p>But I</p>
  <ol>
  <li>Receive results with the StopCodes in ascending order, and not the order of the array</li>
  <li>Do not receive the start and end stops as separate bus stop objects.</li>
  </ol>
  <p>Anyone have any clue how to do this? I've been stuck on it for awhile and would appreciate some help :)</p>