Code and MongoDB: Config Drift Snapshot Recorder Template

A scheduled Spojit workflow that fetches your live service config, diffs it against the last stored snapshot, and records any drift to MongoDB for audit.

What It Builds

A Schedule trigger fires on a cron cadence. A Connector node in Direct mode uses the http connector to pull your live service configuration, then a code node hashes the payload and compares it to the most recent snapshot read from MongoDB. A Condition node checks whether the hash changed, and when it has, the new snapshot and a field-level diff are written back to MongoDB as an audit record.

The Prompt

Paste this into Miraxa and it builds the workflow, connecting the tools for you:

Every hour, fetch our live service config from its API, compute a hash of it, and compare that hash to the most recent snapshot stored in our MongoDB "config_snapshots" collection. If the config changed, save the new snapshot with a timestamp and a field-by-field diff so we have an audit trail of every drift.

Connectors Used

  • Schedule trigger - runs the check on a 5-field cron cadence in your timezone.
  • http - Miraxa connects to your service config API to fetch the live values.
  • code - hashes the config and computes the field-level diff in JavaScript or Python.
  • mongodb - reads the last snapshot and stores each new drift record.

Customize It

Change Every hour to your preferred cadence, swap the config_snapshots collection name, and adjust which config endpoint is fetched. You can also tell Miraxa to ignore noisy fields (timestamps, request IDs) so only meaningful drift is recorded, or to capture multiple services in one run.

Tips

  • Keep the config fetch in Direct mode so it costs no AI tokens; only reach for Agent mode if the response needs interpreting.
  • Store the hash alongside each snapshot so the next run compares in one cheap read.
  • Index the collection on the timestamp field to keep "most recent snapshot" lookups fast as history grows.

Related

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.