[SERVER-81496] Weird shapification behavior for $convert/$toString Created: 27/Sep/23  Updated: 10/Jan/24  Resolved: 28/Nov/23

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

Type: Bug Priority: Minor - P4
Reporter: Charlie Swanson Assignee: Mariano Shaar
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
is depended on by SERVER-85111 Tracking: Known M2 correctness bugs Closed
Related
related to SERVER-74371 Support arbitrary expressions for 'fi... Closed
Assigned Teams:
Query Integration
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.2
Participants:

 Description   

I noticed this while reviewing the pull request for SERVER-74371 "Support arbitrary expressions for 'field' parameter for $getField" - a test case there shows the following:

Current Behavior

{$toString: "$foo"}

will become one of the following, depending on the serialization options:

Representative Shape

{$convert: {
    input: "$foo",
    to: "?"
}}

Debug Shape

{$convert: {
    input: "$foo",
    to: "?string"
}}

Proposed New Behavior

I would propose we do the following instead:

Representative Shape

{$convert: {
    input: "$foo",
    to: "string"
}}

Debug Shape

{$convert: {
    input: "$foo",
    to: "string"
}}



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

Author:

{'name': 'Mariano Shaar', 'email': 'mariano.shaar@mongodb.com', 'username': 'shaargtz'}

Message: SERVER-81496 Weird shapification behavior for $convert/$toString
Branch: v7.2
https://github.com/mongodb/mongo/commit/ca759068b247f9641ffa79549733f513eb3a7cf5

Comment by Githook User [ 28/Nov/23 ]

Author:

{'name': 'Mariano Shaar', 'email': 'mariano.shaar@mongodb.com', 'username': 'shaargtz'}

Message: SERVER-81496 Weird shapification behavior for $convert/$toString
Branch: master
https://github.com/mongodb/mongo/commit/e037a47ed9fed0e381ff294d621036fd31f06226

Comment by Charlie Swanson [ 28/Sep/23 ]

correct william.qian@mongodb.com! I don't know of others off the top of my head, but it is worth a scan through for whoever is implementing this

Comment by William Qian [ 27/Sep/23 ]

This would essentially be a carve-out for $convert to recognize that its to field is a parameter, not input, right? Are there other places where this might apply?

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