Search code examples
meteorminimongo

Preview result of update operation


Is it possible to apply a modifier to a document and see the result before doing the actual update query?

Something like a virtual/simulated update.

My purpose is to validate any possible update inside a before hook through an external service that only accepts some final, post-operation document and then possibly abort the operation.


Solution

  • Minimongo has a function that can be used: LocalCollection._modify(doc, modifier). In order to load LocalCollection on the server, add minimongo to local/packages