Skip to content

Instantly share code, notes, and snippets.

@gkatsanos
Created November 23, 2014 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gkatsanos/cde1dc9be067e2555540 to your computer and use it in GitHub Desktop.
Save gkatsanos/cde1dc9be067e2555540 to your computer and use it in GitHub Desktop.
/**
* List of Messages
*/
var myCoords = [[[ 4.32, 50.84 ], [ 4.01, 50.1 ], [ 4.12, 50.84 ], [ 4.52, 51.84 ]]];
exports.list = function(req, res) { Message.find().where('location').within().geometry({ type: 'Polygon', coordinates: myCoords }).sort('-created').populate('user', 'displayName').exec(function(err, messages) {
if (err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
} else {
res.jsonp(messages);
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment