[Bug]: Mongo aggregate command doesn't parse BSON pipelines properly (variation of #6582) #16887
Open
1 task done
Labels
Backend
This marks the issue or pull request to reference server code
Bug
Something isn't working
High
This issue blocks a user from building or impacts a lot of users
Integrations Product
Issues related to a specific integration
Mongo
Issues related to Mongo DB plugin
Production
Query & JS Pod
Issues related to the query & JS Pod
Is there an existing issue for this?
Description
Aggregate command parses the user input for pipelines and the example from #6582 now works correct. However when mixing the pipeline with some JavaScript parsing errors occur though the evaluated value shown is a correct pipeline.
The key issue seems to be that the ':' that separates the key/value pair cannot be inside the {{JavaScript}} element although evaluated value is exactly the same.
Steps To Reproduce
[ {$sort :{ _id : 1 }}, { $project: { age : 1}}, {$count: "userCount"} ]
[ { $sort :{ {{ Table1.sortOrder.column != "" ? '_id : 1' : '_id : -1 ' }} } }, { $project: { age : 1}}, { $count: "userCount"} ]
[ { $sort :{ _id : {{ Table1.sortOrder.order == "desc" ? '-1' : '1' }} } }, { $project: { age : 1}}, { $count: "userCount"} ]
[ { $sort :{ {{ Table1.sortOrder.column != "" ? '_id' : '_id' }} : {{ Table1.sortOrder.order == "desc" ? '-1' : '1' }} } }, { $project: { age : 1}}, { $count: "userCount"} ]
[ { $sort :{ {{ Table1.sortOrder.column != "" ? '_id:' : '_id:' }} {{ Table1.sortOrder.order == "desc" ? '-1' : '1' }} } }, { $project: { age : 1}}, { $count: "userCount"} ]
Public Sample App
No response
Version
Self Hosted 1.8.0
The text was updated successfully, but these errors were encountered: