Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-597

Corrections for geospatial examples in "within" section of "operators"

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      At http://docs.mongodb.org/manual/reference/operators/#_S_within code is given to find geospatial data within a circle. The following code is given:
      db.collection.find( { location: { $within:

      { $circle: [ center, radius }

      } } );

      A "]" (without quotes) is missing. Also should $circle be changed to $center?

      Using the dataset provided for Chris Harris training session at Kamstrup in Denmark this week i get the following results:

      > db.tweets.find( {"geo.coordinates": {$within: {$center: [[37.75, -122.42],5]} } } ).count()
      13

      > db.tweets.find( {"geo.coordinates": {$within: {$circle: [[37.75, -122.42],5]} } } ).count()
      Mon Oct 08 14:40:53 uncaught exception: count failed: {
      "errmsg" : "exception: unknown $within information :

      { $circle: [ [ 37.75, -122.42 ], 5.0 ] }

      , a shape must be specified.",
      "code" : 13058,
      "ok" : 0

      Attachments

        Activity

          People

            kay.kim@mongodb.com Kay Kim (Inactive)
            rwe@kamstrup.dk Rasmus Weber-Esmann
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11 years, 5 weeks, 6 days ago