📜  使用索引编译 mongodb 数据库 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:14.729000             🧑  作者: Mango

代码示例1
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);
});