MongoDB REST API: redefine API and refactor