From 89ea2d3585e9d6d013fb549e01453ae2c0e8fbc6 Mon Sep 17 00:00:00 2001 From: Coding Friend Date: Sat, 23 Jan 2016 00:28:32 -0600 Subject: [PATCH] Adds in for keys to be made on mongodb schema. --- lib/Drivers/DML/mongodb.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Drivers/DML/mongodb.js b/lib/Drivers/DML/mongodb.js index 9579362d..9f44f1cd 100644 --- a/lib/Drivers/DML/mongodb.js +++ b/lib/Drivers/DML/mongodb.js @@ -45,6 +45,13 @@ Driver.prototype.sync = function (opts, cb) { } pending = indexes.length; + + collection.dropIndexes(); + for (var i = 0; i < opts.id.length; i++) { + var obj = {}; + obj[opts.id[i]] = 1; + collection.createIndex(obj, {unique: true}); + } for (i = 0; i < indexes.length; i++) { collection.createIndex(indexes[i], function () {