Answers for "delete all fields that start with mongo"

C#
0

delete all fields that start with mongo

db.teamList.find().forEach(
    function(document) {
        for(var k in document) {
            if (k.startsWith('team')) {
                delete document[k];
            }
        }
        db.teamList.save(document);
    }
);
Posted by: Guest on March-31-2022

Code answers related to "delete all fields that start with mongo"

C# Answers by Framework

Browse Popular Code Answers by Language