Added mongodb support. Added unit tests