This.params to MongoDB query not working with arrays

I have just upgraded to the newset appsmith, from being many months (8 maybe?) out of date. I am using MongoDB and updated that as well. I have since found what I think is a bug. I have the following MongoDB Find query called “get_student_active_course” that worked before the update:

{
   $and: [
    {end_date:{$gte:ISODate({{moment().format()}})}},
    {start_date:{$lte:ISODate({{moment().format()}})}},
    { _id : { $in : [{{this.params.paramies}}] } }
   ]
}

I am passing the following, which works great if I manually replace it in the query, as the “paramies”:
ObjectId('6316507d58f017caa9bbc2a8'),ObjectId('64063a282e3e538330237284')

via this code(it’s stripped down, but emulates the final code output):

const new_array = [];
for await (const [key, value] of Object.entries(obj)) {
	new_array.push(`ObjectId('${value}')`);
    }
var stringArray = await new_array.toString();
return await get_student_active_course.run({paramies:stringArray })

I know some code is cut out, but the value I posted above for “paramies” is what stringArray is outputting. Before the update, I did not have {{this.params.paramies}} inside an array and was passing
[ ObjectId('6316507d58f017caa9bbc2a8'),ObjectId('64063a282e3e538330237284')]
which was working, then after the update it was throwingan error saying the query need the array.

Any advice on what I might be doing wrong? Or is this a bug?

Hi drew. I’m unsure what went wrong since it worked before the upgrade.
I’ll report this to our engineers. I or someone from our team will contact you once we have any helpful Information.

@Olawale Hey thanks for taking a look! They have any ideas?

Hey @drew could you please share the following information with us?

  1. Does this work fine in Mongo Compass?
  2. Could you please show us screenshots of the query configuration and the error?
  3. You can grab the logs by running docker logs -f appsmith, or you could follow the steps from this guide on how to get the logs.