MongoDB $rename
How to change the name of document property in mongoDB ?
Using $rename operator we can rename the document in mongoDB , $rename can be used only in updateOne() and updateMany() method
{
test : 'something'
}
If I want to change the name of test property of the above document to description
db.collection.updateOne({},{$rename:{test:"description"}})
Output:
{
description:"something"
}