mongo: add comments and docstrings