2017-01-10

MongoDB - How to update a field using the value from another field

db.collection_name.find({filter_here_if_any}).forEach( function(doc) {
    doc.target_field_name = doc.source_field_name;
    db.collection_name.save( doc );
});

No comments:

Post a Comment