Revert "Simplify conditional in mongo db"

This reverts commit 03ee97778ee4c5d43820569f833f200225d5f9a6.