Use MongoDB change streams to handle policy changes

  • We would like the policy service to cache and compile in-memory the policies, so that they are always ready for evaluation.

  • We would like to avoid fetching policy state from the MongoDB on every policy execution

  • We can use the MongoDB change streams feature to notify our service about DB collection changes so that the service can recompile and re-cache the policies when they are changed.