I ran into an issue where performing a $rename did not work as expected. If I run $rename once, it will correctly rename the field. If I run the same $rename again it will try to rename the non-existent field over the new field, and null it out. Reading the mongo docs, if you try to rename a field that does not exist, it should be a noop.
I made the required change, and added a test to cover. Happy to take comments if I have missed something.
I ran into an issue where performing a $rename did not work as expected. If I run $rename once, it will correctly rename the field. If I run the same $rename again it will try to rename the non-existent field over the new field, and null it out. Reading the mongo docs, if you try to rename a field that does not exist, it should be a noop.
I made the required change, and added a test to cover. Happy to take comments if I have missed something.