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

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

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • Server
    • None

    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

        Activity

          People

            scotthernandez Scott Hernandez (Inactive)
            cwestin Chris Westin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              12 years, 25 weeks, 6 days ago