mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-26 04:09:50 -05:00
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
support legacy pair array with centerSphere. Native behaviour looks like following, supporting similar behaviour -
```
> db.coll.find()
{ "_id" : ObjectId("666016ebb648c6bfc6008730"), "geo" : [ { "x" : 1, "y" : 1 }, { "x" : 2, "y" : 2 }, { "x" : 3, "y" : 3 } ] }
{ "_id" : ObjectId("666016f0b648c6bfc6008731"), "geo" : [ [ 1, 1 ], [ 2, 2 ], [ 3, 3 ] ] }
> db.coll.getIndexes()
[
{
"v" : 2,
"key" : {
"_id" : 1
},
"name" : "_id_"
},
{
"v" : 2,
"key" : {
"geo" : "2d"
},
"name" : "geo_2d"
}
]
> db.coll.find({geo: {$geoWithin: {$centerSphere: [[0,0], 1]}}})
{ "_id" : ObjectId("666016ebb648c6bfc6008730"), "geo" : [ { "x" : 1, "y" : 1 }, { "x" : 2, "y" : 2 }, { "x" : 3, "y" : 3 } ] }
{ "_id" : ObjectId("666016f0b648c6bfc6008731"), "geo" : [ [ 1, 1 ], [ 2, 2 ], [ 3, 3 ] ] }
> db.coll.createIndex({geo: "2dsphere"})
{
"ok" : 0,
"errmsg" : "Index build failed: 44278214-23a2-466f-9fa8-78f385840fb5: Collection test.coll ( a0395bdf-8f3e-4ca7-9426-8d741b3ca75d ) :: caused by :: Can't extract geo keys: { _id: ObjectId('666016ebb648c6bfc6008730'), geo: [ { x: 1.0, y: 1.0 }, { x: 2.0, y: 2.0 }, { x: 3.0, y: 3.0 } ] } Point must only contain numeric elements, instead got type object",
"code" : 16755,
"codeName" : "Location16755"
}
```
Related work items: #3256077