How do I set up a date picker in a table and save dates with MongoDB?

Hi, I connected a table to my Mongo database fine. I want to let a user modify dates on each record.

I set up a column with column type Datepicker. Set the calculation to = {{currentRow.publishedOn}} to pull in the default date, but see Invalid date in the date picker.

Also added an action “Save date” to save the newly selected date and have it running a query updateOne with { $set: { publishedOn: {{[i].newPublishedOn}}

I think the error is in how I’m trying to select data from Retool because when I hard code values, the query runs fine and successfully saves.

And here’s how the table looks

@letterdrop and I solved this over chat, but for anyone that stumbles onto this post, we made two major changes to get the query to successfully change the date!

  1. The new date was coming from a calculated column, so we had to reference it from postsTable.changeSet.
  2. The date returned by the date picker column type was not a string, so we added some quotation marks! { $set: { publishedOn: "{{ postsTable.changeSet[i]['Calculated Column 1'] }}" }}