title: How can I save query data from another mongoDB to the collection of DB I am currently connected to?
body: <p>I've got two databases and I want to write data from another DB in the collection.</p>
  <p>I am connected to a mongoDB with
  <code>mongoose.connect(&quot;mongodb://XXX:YYY@localhost:27017/realtime?authSource=admin&quot;</code></p>
  <p>and writing into a collection based on the Model I currently use.</p>
  <p>There is one key-value-pair (it's a timestamp) I need from a different DB which runs on the same port <code>mongodb://XXX:YYY@localhost:27017/timetable?authSource=admin</code>.</p>
  <p>Here is a snippet, hope that'll help.</p>
  <pre><code>    EntityModel
      .find({})
      .limit(10)
      .then((entities) =&gt; {
        entities.forEach((entity) =&gt; {
  
          // this is where I need to access the other DB
          // to get arrivalTimetable from the timetable database for Each entity
  
              tripData.stops.push({
                stop_id: stu.stopId,
                arrivalTimetable: arrivalTimetable,
                arrivalRealtime: arrivalRT
              });
          const tripDelay = new TripDelay(tripData);
          trip.save();
  }
  </code></pre>
  <p>What is a good way, to get the data needed and save it to the current collection?</p>