[DOCS-50] geo-spatial indexes could be damaged by field re-orderings Created: 25/Aug/11  Updated: 30/Oct/23  Resolved: 25/Aug/11

Status: Closed
Project: Documentation
Component/s: Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Task Priority: Major - P3
Reporter: Chris Westin Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-2592 The fields in a document are reordere... Closed
Participants:
Days since reply: 12 years, 25 weeks, 6 days ago

 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.



 Comments   
Comment by Scott Hernandez (Inactive) [ 25/Aug/11 ]

I updated the docs.

Generated at Thu Feb 08 07:37:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.