Extended mongo code