Added support of pagination for mongodb related to issue #368