Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

compy mongodb database with indexes

var indexes = db.user.getIndexes();

indexes.forEach(function(index){
    delete index.v;
    delete index.ns;
    var key = index.key;
    delete index.key
    var options = [];
    for (var option in index) {
        options.push(index[option]);
    }
   db.usertest.createIndex(key, options);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #compy #mongodb #database #indexes
ADD COMMENT
Topic
Name
1+4 =