Answers for "how to find and delete something in mongodb .net"

5

mongodb delete all documents

db.collection.delete_many( { } );
Posted by: Guest on April-20-2020
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 "how to find and delete something in mongodb .net"

Browse Popular Code Answers by Language