Best way to check in bulk if documents in a MongoDB collection have been updated, and then trigger a workflow for each document which has been updated

Hello,

I have a workflow which currently triggers when a new document is added to a MongoDB, and we add that document to a row in Google sheets - this works like a charm!

Now, I’m trying to create a new workflow which checks to see whether a value in a document has changed/updated, and then update that specific row in the Google sheet. I can generate an array of all the documents in the database, but not sure if iterating over each record to see whether there has been an update by comparing each row in the Google sheet is the correct approach.

Any other suggestions greatly appreciated!

Hi @dd,

Hello!

For detecting changes in a MongoDB document, you can use the “New Field in Document” trigger. Here’s how to set it up:

  1. Search for the MongoDB app from the trigger menu
  2. Select the “New Field in Document” trigger
  3. Connect your MongoDB account
  4. Select a Database or pass a string from a previous step
  5. Select a Collection or pass a string from a previous step
  6. Select a Document or pass a string from a previous step
  7. Follow the instructions on the trigger configuration screen. You may need to generate a test event from MongoDB to get real data to test your workflow.

Once you have the trigger set up, you can use the “Update a Document” action for MongoDB to update the specific row in the Google Sheet:

  1. Search for the MongoDB app from the step menu
  2. Select the “Update a Document” action
  3. Connect your MongoDB account
  4. Select a Database or pass a string from a previous step
  5. Select a Collection or pass a string from a previous step
  6. Select a Document or pass a string from a previous step
  7. Select Data or pass an object from a previous step
  8. At the bottom of the step, click Test to run the action and test the configuration

This should help you create a workflow that checks for updates in MongoDB documents and updates the corresponding row in the Google Sheet.
I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double check my answers and code! Learn how to build your own.