Refactor: Updating mongodb example with working code and tests