title: MongoDb stopping again and again
body: <p>I'm trying to make a node-mongo application on a digital ocean basic server (1GB mem, 25GB SSD, 1vCPU). The mongo server crashes again and again.</p>
  <p>This is the mongo log file just before crash</p>
  <p><a href="https://i.stack.imgur.com/2EZ4t.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2EZ4t.jpg" alt="enter image description here" /></a></p>
  <p>Through looking at the logs and doing some research I've found that multiple slow queries are causing this server overload triggering the stopping of mongod.</p>
  <p>The mongoose query is as follows</p>
  <pre><code>  // Get a batch of external links in each iteration
    const externalLinkObjs = await linkSchema
      .find({}, { _id: 1, domainId: 1, externalLink: 1, isHidden: 1 })
      .skip(skip)
      .limit(this.filterLimit);
  </code></pre>
  <p>linkSchema</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    const linksSchema = new mongoose.Schema({
      domainId: {type: mongoose.Schema.Types.ObjectId, required: true, ref: 'domains'},
      articleId: {type: mongoose.Schema.Types.ObjectId, required: true, ref: 'articles', index: true},
      externalLink: {type: String, required: true, minlength: 4},
      rel: {type: String, required: true, default: "dofollow"},
      anchorText: {type: String, trim: true, default: ""},
      isHidden: {type: Boolean, default: false},
      status: {type: Boolean, default: false}
  }, {
      timestamps: true
  });</code></pre>
  </div>
  </div>
  </p>
  <p>Is there a way to optimize this query?</p>