PHP
1
Вклад в тег
var maxDistance = Number(query.distance);
var limit = Number(query.limit);
var page = Math.max(0, query.page);
var loc = [];
loc[0] = Number(query.lon);
loc[1] = Number(query.lat);
User.find({
loc: {
$near: loc,
$maxDistance: maxDistance
}
}).limit(limit).skip(limit * page).sort({username: 'asc'}).exec(function(err, locations) {
// ....
});
// User schema
/*
....
loc: {
type: [Number],
index: '2d'
}
....
*/