From 47315d5f1f2224a99b8cb4ad2e90476c3dd61f14 Mon Sep 17 00:00:00 2001 From: Khaazz Date: Mon, 13 Aug 2018 01:12:57 +0200 Subject: [PATCH] Added a method to update guildSchema --- src/Database/MongoService.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Database/MongoService.js b/src/Database/MongoService.js index acfac45b..25f4bfbf 100644 --- a/src/Database/MongoService.js +++ b/src/Database/MongoService.js @@ -241,6 +241,26 @@ class MongoService { static saveSchema(schema) { return schema.save(); } + + /** + * Save Guild Schema + * + * @static + * @param {String} gID - Guid id + * @param {Object} schema - Guild Schema to save + * @returns {Promise} Updated SChema111 + * @memberof MongoService + */ + static saveGuildSchema(gID, schema) { + return Guild.findOneAndUpdate({ + guildID : gID, + }, + schema, + { + new: true, + upsert: true, + }); + } } export default MongoService;