Refactored mongodb provider.
Added debug info in order to find a problem with mongodb connection closing.