Can not use $rename to rename property of documents
I have a mongoose Schema and I would like to rename a certain property named 'template' to 'document'.
If I would first change name of the property from 'template' to 'document' in the Schema and than try to use updateMany, nothing happens.
var results = await Document.updateMany(
{ templateType: {$exists: true}},
{ $rename: { templateType: "documentType" } }
);
When updateMany runs, results.modifiedCount is greated than 0, but documents still all have templateType when I view them in compass.
Thanks,