How to covert a MongoDB string field to an array
db.collection.find().forEach(function(myDocument) {
db.collection.update(
{ _id: myDocument._id },
{ "$set": { "fieldToUpdate": [myDocument.fieldToUpdate] } }
);
})
db.collection.find().forEach(function(myDocument) {
db.collection.update(
{ _id: myDocument._id },
{ "$set": { "fieldToUpdate": [myDocument.fieldToUpdate] } }
);
})