From cf5d9b7d40b904ea7696c4943b7d67da2e00f433 Mon Sep 17 00:00:00 2001 From: Sundarasan Date: Mon, 24 Jul 2017 21:09:39 +0530 Subject: [PATCH] Added post update hook --- lib/mongoosastic.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/mongoosastic.js b/lib/mongoosastic.js index 7d85f668..ff5aa1e0 100644 --- a/lib/mongoosastic.js +++ b/lib/mongoosastic.js @@ -812,6 +812,9 @@ function Mongoosastic (schema, pluginOpts) { inSchema.post('insertMany', (docs) => { docs.forEach((doc) => postSave(doc)) }) + inSchema.post('update', function () { + this.model.synchronize(this.getQuery()) + }) } if (indexAutomatically) {