All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scripts.3.0.0.3-replace-apiArray-by-unique-api.js Maven / Gradle / Ivy

There is a newer version: 4.5.2
Show newest version
print('Plans migration - plans have now only one api');
db.plans.dropIndexes();
db.plans.find().forEach(
    function(plan) {
        
        var apiId = plan.apis && plan.apis[0];
         
        if(apiId) {
            db.plans.updateOne(
                { _id: plan._id },
                {
                    $set: { api: apiId},
                    $unset: { apis: '' }
                }
            );
        }
        
    }
);
db.plans.createIndex( { "api" : 1 } );
db.plans.reIndex();




© 2015 - 2024 Weber Informatics LLC | Privacy Policy