db.question.find().forEach( function(myDoc) { if (myDoc.comment){ db.question.updateOne( { "_id": myDoc._id }, { "$set": { "comment": myDoc.comment.trim() } } ); } } )
db.question.find().forEach( function(myDoc) { if (myDoc.comment){ db.question.updateOne( { "_id": myDoc._id }, { "$set": { "comment": myDoc.comment.trim() } } ); } } )