How to modify a every field on every document(row) in a MongoDB Collection to Lowercase/Uppercase

The first parameter after the find is the query, in this case {} indicates an empty query (do the following statements on all rows [documents] in the collection. <pre> db.yourCollectionName.find( {}, { 'desiredFieldname': 1 } ).forEach(function(doc) {   db.yourCollectionNameupdate(       { _id: doc._id},       { $set : { 'desiredFieldname' : doc.desiredFieldname.toLowerCase() } },       { multi: true }    […]

How to delete multiple columns (fields) from a MongoDB Collection

MongoDB is not SQL. There can be a schema to enforce types, but often there is no schema. You essentially have to update all the documents in the collection. <pre> db.yourcollectionname.updateMany({}, {     $unset: {         'field1': 1,         'field21,         'field31     } }) </pre> I believe the value of “1” is used after each field just because they […]