I was investigating why some users were losing their data, and discovered that data was being written to the wrong MongoDB collection, in the process overwriting existing data. I narrowed it down to a piece of code that was using Mongoengine's switch_collection
. I noticed when looking at the logs that …