As I’m working on a new website on node.js with MongoDB (with mongoose), I’m just realizing how powerful is this combination. Just amazing.
In one of the new features I was developing I wanted to use geolocation on my searchs.
One of the first things you have to do is to tell mongoose (or MongoDB native driver) that one attribute is going to have a 2D index
After that, we can include one method to find near places to the schema
Now, if you’re using express.js, you can define a route in your app.js file (or whatever you call it and just add this function)
As you can see, It’s incredible what you can achieve with just a bunch of lines of code.
I’m falling in love with Node.js!
See you later guys!!!!