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

scripts.1.25.0.1-applications-migration.js Maven / Gradle / Ivy

There is a newer version: 4.5.2
Show newest version

print('Applications migration');
db.applications.find().forEach(
    function (application) {
        print("    update the application");

        if (application.type && !("metadata" in application)) {
            print("    set the SIMPLE application type for: " + application._id);
            db.applications.updateOne(
                { _id: application._id },
                {
                    $set: { "metadata.type" : application.type },
                    $unset: { type: "" }
                });
        }

        if (application.clientId) {
            print("    put the clientId of the application into metadata: " + application._id);
            db.applications.updateOne(
                { _id: application._id },
                {
                    $set: { "metadata.client_id" : application.clientId },
                    $unset: { clientId: "" }
                });
        }

        db.applications.updateOne(
            { _id: application._id },
            { $set: { type: 'SIMPLE' }});
    }
);




© 2015 - 2024 Weber Informatics LLC | Privacy Policy