MongoDB spatial location (point) and distance retrieval, mongodb Retrieval

Source: Internet
Author: User

MongoDB spatial location (point) and distance retrieval, mongodb Retrieval

MongoDB 2.6-based


GeoJSON format

{"Type": "Point", "coordinates": [lon (longitude), lat (latitude)]}

Test Data

Db. point. test. insert ({"address": "Nanjing lukou International Airport", "loc": {"type": "Point", "coordinates": [118.783799, 31.979234]}) db. point. test. insert ({"address": "Nanjing pukou Park", "loc": {"type": "Point", "coordinates": [118.639523, 32.070078]}) db. point. test. insert ({"address": "Nanjing Railway Station", "loc": {"type": "Point", "coordinates": [118.803032, 32.09248]}) db. point. test. insert ({"address": "Nanjing Xinjiekou", "loc": {"type": "Point", "coordinates": [118.790611, 32.047616]}) db. point. test. insert ({"address": "Nanjing zhangfu Park", "loc": {"type": "Point", "coordinates": [118.790427, 32.03722]}) db. point. test. insert ({"address": "Sanshan Street, Nanjing", "loc": {"type": "Point", "coordinates": [118.788135, 32.029064]}) db. point. test. insert ({"address": "Nanjing zhongmen", "loc": {"type": "Point", "coordinates": [118.781161, 32.013023]}) db. point. test. insert ({"address": "Nanjing andmen", "loc": {"type": "Point", "coordinates": [118.768964, 31.99646]})

Must be indexed

db.point.test.ensureIndex( { loc : "2dsphere" } )

Retrieve data within a specified radius (in meters)

{Loc: {$ near: {$ geometry: {type: "Point", coordinates: [118.783799, 31.979234]}, $ maxDistance: 5000 }}// data within 5000 meters






Using the culture market positioning theory, we will analyze how Baidu has become the best search engine in China through successful positioning.

I 'd like to answer this question.
First, analyze Baidu's products. We recommend that you open Baidu-more, open all services, and you will find that Baidu's products are divided into several categories, search, navigation, community, games, mobile, webmaster, software, and others
Searching is the most basic information for people.
Navigation is to classify information
The content in the Community is closer to and more similar to the community where people live. It is similar to a group of people gathering together in the park, talking about things and chatting, the function of the Community is to create a virtual community. This will certainly spread the culture and will be discussed later.
Games are designed to meet the needs of people who like entertainment.
Mobile is becoming more and more popular and widely used in communication.
Webmasters meet special IT needs
Services for the blind, the elderly, and children with loss in other categories

In its positioning in the market, Baidu is catching up with Google, a technical eldest brother, and developing information services that meet various needs. He not only provides the same retrieval and sharing of these two original functions, other requirements are also achieved through the construction of virtual space

Baidu's strategy is to allow more people to participate and optimize the quality of information. For example, the posts and the stars all know that Baidu is an expert with a lot of knowledge, in this way, information availability is improved a lot and potential value is explored.

The so-called cultural market is a broad scope. The spread of various knowledge among people is an effective culture. Baidu attaches great importance to the role of people, this is in line with the taste of the Chinese people, so many people say that Baidu is very good, Google is not good, of course, there are also people with strong professional needs to promote Google search more professional

How can I reference the mongoDB module in eclipse's pydev environment?

Open the eclipse option dialog box:

Click "New Folder" or "New Egg" on the right side, and locate the site-packages Folder in the dialog box (you can search for the Folder if it is not found ). Select the directory or egg file of the package you installed (check whether your package is a file or a folder ). Click "Apply", and then click "OK" after running. Then your code will prompt you. If not, restart.

Hope to adopt it!



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.