Complete the code to rename the field 'oldName' to 'newName' in a MongoDB update operation.
db.collection.updateOne({}, { $rename: { [1]: 'newName' } })The $rename operator requires the current field name as the key and the new field name as the value.
Complete the code to rename the field 'username' to 'user_name' in all documents.
db.collection.updateMany({}, { $rename: { [1]: 'user_name' } })The $rename operator needs the exact current field name as the key to rename it.
Fix the error in the code to rename 'address' to 'location' in one document.
db.collection.updateOne({}, { $rename: { address: [1] } })The new field name must be a string inside quotes when used as the value in $rename.
Fill both blanks to rename 'phone' to 'contactNumber' in all documents.
db.collection.updateMany({}, { $rename: { [1]: [2] } })The $rename operator needs the old field name as the key and the new field name as the value, both as strings.
Fill all three blanks to rename 'email' to 'contactEmail' and 'dob' to 'dateOfBirth' in one update operation.
db.collection.updateMany({}, { $rename: { [1]: [2], [3]: 'dateOfBirth' } })Use $rename with old field names as keys and new field names as values, all as strings.