title: fetching data from mongodb and find closest value
body: <p><strong>My code look like this:</strong> </p>
  
  <pre><code>const express = require('express');
  const mongoose= require('mongoose');
  
  const Schema = mongoose.Schema;
  
  const ourDataSchema = new Schema ({
     rank : Number,
     totalPoints : Number
  });
  
  const rankTotalpoint = mongoose.model("rankTotalpoint", ourDataSchema);
  
      const ourData = [
       {rank :1, totalPoints  : 2000},
       {rank :2, totalPoints  : 1980},
       {rank :3, totalPoints  : 1940},
       {rank :4, totalPoints  : 1890},
       {rank :5, totalPoints  : 1830},
       {rank :6, totalPoints  : 1765}
  ];
  
  rankTotalpoint.create(ourData, function (error) {
      console.log('saved!');
      if (error) {
          console.log(error)
      }
  });
  ...
  </code></pre>
  
  <p>I have 2 questions:</p>
  
  <ol>
  <li><p>How can I fetch a <strong>rank</strong> by it's <strong>totalPoint</strong>? </p>
  
  <ul>
  <li>I tried <code>find()</code> but it didn't work, I guess I'm using it in a wrong way.</li>
  </ul></li>
  <li><p>I'm getting an input(Number) from user, I want to match the number with the <strong>totalPoint</strong>(if exists) that we fetched from our database <em>and return it's rank</em>, and if the exact number didn't exist, I want to match it with the closest totalPoint in our database and return the rank as a response. </p></li>
  </ol>
  
  <p>Please at least answer my first question!</p>
  
  <p>Highly appreciate your answers guys,
  I'm STUCK!</p>