[SERVER-54105] $geoNear in $lookup with dynamic coordinates from "parent" collection Created: 28/Jan/21 Updated: 06/Dec/22 Resolved: 02/Feb/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 4.4.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Dimitris Papatsarouchas | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Query
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
Hello, I'm trying to get nearest points from joined collection like this:
So i need for every point in collectionA to find nearest points in the collectionB. On the specified aggregation im recieving the following error:
I tried to remove that field and the following message:
I also tried to specify in the let section the numbers like this:
But with the same results
Thanks |
| Comments |
| Comment by Dimitris Papatsarouchas [ 29/Jan/21 ] | ||
|
Hello Edwin Zhou Thank you for your help !
Best regards, Dimitris | ||
| Comment by Edwin Zhou [ 28/Jan/21 ] | ||
|
Hi d.papatsarouchas@gmail.com, Thank you for providing extra details and clarifications. I was successful in reproducing your issue. It appears that using the variables specified by let in the coordinates field of $geoNear in the $lookup stage pipeline will cause an error to be thrown. We're assigning this ticket to the appropriate team to be further investigated. Best, | ||
| Comment by Dimitris Papatsarouchas [ 28/Jan/21 ] | ||
|
Hello Edwin Zhou Thank you for your answer, I have both collections indexed with 2dsphere on the geometry field, I'm sorry I forgot to mention that. Also the collectionA is sharded and collection B is not so I can use $lookup. I just tried the same query on an unsharded mongo:4.4.3 and mongo:4.4.2 and I have the same error message. I'm running mongo in Docker.
Best regards, Dimitris
— EDIT This comes up from mongo shell:
| ||
| Comment by Edwin Zhou [ 28/Jan/21 ] | ||
|
Hi d.papatsarouchas@gmail.com, I was able to successfully reproduce your issue and reached the same error. I was also able to work around that error by creating a 2dsphere index on collectionB on the geometry field:
I was able to query the document without errors. Can you try to run the same query after creating the index on the from field of $lookup? Best, |