title: MongoDB and nodeJS: high latency time using 2dsphere index
body: <p>i am working on a nodeJS application with mongoDB and i am trying to get all users next to the current user...</p>
  
  <p>my real problem is that my application works quiet well when my query is based on a "2d" index ( i got about 25000 responses in 1 min ) but when i am trying the same with a "2dsphere" index i have high latency time (1 request take more than 2 seconds of execution)...</p>
  
  <p>Here is my request :</p>
  
  <pre><code>app.get('/findInsertLocGeoNear100true', function(req, res) {
      var obj = getRandomCoordonnee();//"obj" = random longitude and latitude.
        userModel.geoNear({
         type: "Point" ,
         coordinates: [ obj.lat,obj.lng ]
      },
      { maxDistance : 5,
        spherical : true,
        num : 100   
      },
      function(err, results, stats) {
          res.json(200, results);
         console.log(err);
      });
  });
  </code></pre>
  
  <p>And here is my schema mongoose :</p>
  
  <pre><code>var userSchema = new mongoose.Schema({
    loc: {type: [Number]},
    name : { type : String, match: /^[a-zA-Z0-9-_]+$/ },
    dateLastActivity : { type : Date, default : Date.now },
    type: Number
  });
  </code></pre>
  
  <p>NB: MongoDB runs on an ubuntu server and my index is created with "db.users.ensureIndex({"loc":"2dsphere"})"</p>
  
  <p>If you have any advices, best practices or suggestions to improve my performances, i would be glad to heard them.
  Thanks !
  Best regards.</p>