I am trying to build a dynamic Mongodb query resource that will add filters to the query when items are selected from various multiselect boxes.
Steps: I have build an aggregation resource query in mongo, I have built transformers that check to see if the value of a selectbox has been selected and if so will return a mongoDB object. I have tried to JSON.stringify() but nothing seems to work.
Ugh. I don't use MongoDB, so I don't know how all the parts work together and what they all expect in terms of format of the input.
If you came to my house and asked me to fix it in return for a beer on you, I would try:
(1) JSON.stringify the termsTransformer result so that it is a string passed to the Aggregation instead of an object
(2) leave termsTransformer as an object and add JSON.stringify(termsTransformer.value) to the Aggregation
(3) write the whole aggregation in a JS query that returns the fully formed JSON as an object and try passing that to the Aggregation section of the query
(4) Do (3) but JSON.stringify() it before passing it
(5) Do (3) but JSON.stringify() it in the Aggregation section of the query
(6) Give up and buy you the beer instead...
I put the bug tag on the post for you to get a few more eyes on it - maybe someone who uses MongoDB in Retool all the time is chuckling contentedly for the two free beers they are about to get by answering this super easy question
post-facto edit to note that option (3) worked as the solution