title: Sails.js $near query does not work and asks for indices
body: <p>I'm trying to query the nearest points to some coordinate in Sails.js using MongoDB, but I'm getting the following error:</p>
  
  <pre><code>{ [MongoError: can't find any special indices: 2d (needs index), 2dsphere (needs index),  for: { $near: { $geometry: { type: "Point", coordinates: [ "4.3795912", "51.9985675" ] }, $maxDistance: 1000 } }] name: 'MongoError' }
  </code></pre>
  
  <p>I made sure I had this in bootstrap.js:</p>
  
  <pre><code>sails.models.location.native(function (err, collection) {
          collection.ensureIndex({ coordinates: '2dsphere' }, function () {
  
  
              cb();
  
          });
      });
  </code></pre>
  
  <p>And my <code>Location</code> model looks like this:</p>
  
  <pre><code>attributes: {
  
        coordinates: {
            type: 'json'
        },
        user: {
            model: 'user'
        }
    }
  </code></pre>
  
  <p>My controller code is the following:</p>
  
  <pre><code>Location.native(function(err, collection) {
  
              var query = {};
  
              collection.find(
                  query.coordinates = {
                      $near: {
                        $geometry: {
                          type: "Point",  
                          coordinates: [
                            user.locations[0].lng, 
                            user.locations[0].lat 
                          ]
                        },
                        $maxDistance : 1000 
                      }
                    }
                  ).toArray(function(err, result){
                          if(err) {
                              console.log(err);   
                          }
                          else 
  
                              return res.json(result);
                  });
          });
  </code></pre>
  
  <p>I'm pretty sure I did just what I was supposed to do, but apparently I have done something wrong or I forgot something. Anyone any idea how to get this to work? Thanks.</p>