[SERVER-7241] should 2d indexes not be allowed to be unique? Created: 03/Oct/12  Updated: 06/Dec/22  Resolved: 05/Jul/19

Status: Closed
Project: Core Server
Component/s: Geo
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Aaron Staple Assignee: Backlog - Query Team (Inactive)
Resolution: Won't Do Votes: 0
Labels: query-44-grooming
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query
Participants:

 Description   

Uniqueness enforcement for 2d indexes seems to be constrained by the precision of the location information stored in the btree. (Two different locations with the same geo hash are not allowed in a unique index.) Does this mean we shouldn't allow geo indexes to be unique?

> c.drop()
true
> c.ensureIndex( { a:'2d' }, { unique:true } )
> c.save( { a:[ 0, 0 ] } )
> c.save( { a:[ 0, 0.00001 ] } )
> c.save( { a:[ 0, 0.000001 ] } )
E11000 duplicate key error index: test.c.$a_2d  dup key: { : BinData }


Generated at Thu Feb 08 03:13:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.