From 5ccfdd2fc9ec118eee015fe380982921adcb64f3 Mon Sep 17 00:00:00 2001 From: Gabriel Grubba Date: Fri, 25 Nov 2022 07:52:09 -0300 Subject: [PATCH] fix: removed unecessary promise --- packages/mongo-async/mongo_driver.js | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/packages/mongo-async/mongo_driver.js b/packages/mongo-async/mongo_driver.js index aead47ab90..0de93d0c5f 100644 --- a/packages/mongo-async/mongo_driver.js +++ b/packages/mongo-async/mongo_driver.js @@ -845,15 +845,7 @@ MongoConnection.prototype.createIndex = async function (collectionName, index, // We expect this function to be called at startup, not from within a method, // so we don't interact with the write fence. var collection = self.rawCollection(collectionName) - const p = new Promise(async (resolve, reject) => { - try { - const i = await collection.createIndex(index, options) - resolve(i) - } catch (e) { - reject(e); - } - }) - var indexName = await p + var indexName = await collection.createIndex(index, options) }; MongoConnection.prototype._ensureIndex = MongoConnection.prototype.createIndex; @@ -864,15 +856,7 @@ MongoConnection.prototype._dropIndex = async function (collectionName, index) { // This function is only used by test code, not within a method, so we don't // interact with the write fence. var collection = self.rawCollection(collectionName); - const p = new Promise(async (resolve, reject) => { - try { - const i = await collection.dropIndex(index) - resolve(i) - } catch (e) { - reject(e); - } - }) - var indexName = await p; + var indexName = await collection.dropIndex(index) }; // CURSORS