This encodes more business logic in the notification hook, which complicates our deployment since it means notification processing is further coupled to deployed metadata, however it can be a good performance improvement in some cases.
A tradeoff between complexity and performance.
That being said, there is another way to improve performance in all cases that does not add as much complexity. See: esbtools/event-handler#70
Impl note: the query could be evaluated simply against the post document provided to the hook. If it matches the document, then we will write the notification. Consider which is faster: evaluating the query first or evaluating the watch projection first.
/cc @paterczm since we were talking about this a bit today.