$ geoWithin查询表单mongodb到mongoose语句

从mongodb获得这个查询:

db.location.find( {loc: { $geoWithin: { $centerSphere: [ [ 9, 9], radius ] } }, action:1 }) .limit(10) .skip(1, function(err, result) { console.dir(result); }); 

如何将它翻译成使用geoWithinmongoose声明?

那么有些事情是这样的:

  LocationModel.where('loc').within({ center: [ your_lat, your_lng], radius: your_radius, unique: true, spherical: true }).where('action').equals(your_action).skip(your_skip).limit(10).exec( function(err, result) { console.dir(result); }); 

当然,需要创buildLocationModel和LocationSchema,我希望它可以帮助。