MongoDB logged lower profit in its latest quarter, due to higher costs, as revenue rose.