Refactored mongodb_store.js