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

geo-spatial indexes could be damaged by field re-orderings

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Server
    • Labels:
      None
    • # Replies:
      1
    • Last comment by Customer:
      true

      Description

      The documentation for geo-spatial indexes describes support for co-ordinates stored as arrays or field values. This is under the expectation that fields in documents are not reordered. However, we can sometimes re-order fields: https://jira.mongodb.org/browse/SERVER-2592 .

      This can lead to broken indexes in the following scenario:
      (2:31:54 PM) Chris Westin: so, if we're sometimes re-ordering fields on updates, won't that garble position dependent geo-spatial index values? e.g. {loc:{long:40, lat:73}} gets reordered (alphabetically), and the index lookup gets whacked?
      (2:37:49 PM) dev@10genchat.appspotchat.com: [scott] only if you add a new field to loc
      (2:38:18 PM) dev@10genchat.appspotchat.com: [scott] It only reorders at the level you make changes
      (2:39:04 PM) Chris Westin: yes. then suppose i update the co-ordinates. Does it look them up by the new order, and fail to find (or find the wrong ones) in the index, and possibly update the wrong index record?
      (2:39:16 PM) dev@10genchat.appspotchat.com: [scott] yes
      (2:39:37 PM) Chris Westin: excellent. so current recommendation should be to use the array form of co-ordinates, until we fix that update bug
      (2:39:38 PM) dev@10genchat.appspotchat.com: [scott] but only if the doc changes size
      (2:39:43 PM) dev@10genchat.appspotchat.com: [scott] yes

      Until SERVER-2592 is fixed, perhaps the docs should recommend only using the array form for co-ordinate storage.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              scotthernandez Scott Hernandez
              Reporter:
              cwestin Chris Westin
              Participants:
              Last commenter:
              Jonathan Dahl
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since reply:
                8 years, 47 weeks, 3 days ago
                Date of 1st Reply: