[SERVER-84446] Reparsing $geoNear $geometry fails when type is not specified in the query. Created: 28/Dec/23  Updated: 02/Jan/24  Resolved: 02/Jan/24

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.3.0-rc0

Type: Bug Priority: Major - P3
Reporter: Santiago Roche Assignee: Santiago Roche
Resolution: Fixed Votes: 0
Labels: flag-for-2885-backport
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

This issue was found in BF-31277. 

We encountered a reparsing failure during $queryStats, when we have the following find query with $geoNear:

db.col.find({geo: {$geoNear: {$geometry: {coordinates: [10,10]}}}})

Although most queries with this form specify a "type" in the $geometry operand, it is not enforced nor required. The default behaviour when parsing $geometry objects is to treat the geometry as a point. The serialization for representative shape has to default to using a point type as well to ensure we can re-parse correctly.

 

 



 Comments   
Comment by Githook User [ 02/Jan/24 ]

Author:

{'name': 'Santiago Roche', 'email': '69868136+sroches@users.noreply.github.com', 'username': 'sroches'}

Message: SERVER-84446: Fix re-parsing of $geometry without specified type. (#17800)

GitOrigin-RevId: da306c00a6766c28afbbd9d149c0cdcf6799565a
Branch: master
https://github.com/mongodb/mongo/commit/e21b2e3cbf9748c59c8bf797e0f61eab5d1279a5

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