lib/db.js
/**
 * @brief This function sets up the mongodb utility object.
 *
 * @return object Mongodb utility object containing the following methods:
 *                - insert
 *                - lookup
 *                - upsert,
 *                - update
 */
@brief This function sets up the mongodb utility object.
@return object Mongodb utility object containing the following methods:
- insert
- lookup
- upsert,
- update
@brief This function sets up the mongodb utility object . @return object Mongodb utility object containing the following methods : - insert - lookup - upsert - update
function initializeDb() {
    'use strict';
    function insert(record, callback) {
        record.save(callback);
    }
    function lookup(model, criteria, callback) {
        model.findOne(criteria, callback);
    }
    function update(record, callback) {
        record.save(callback);
    }
    return Object.freeze({
        insert,
        lookup,
        update
    });
}
function initializeDb ( ) { 'use strict' ; function insert ( record , callback ) { record . save ( callback ) ; } function lookup ( model , criteria , callback ) { model . findOne ( criteria , callback ) ; } function update ( record , callback ) { record . save ( callback ) ; } return Object . freeze ( { insert , lookup , update } ) ; }
@brief This function sets up the mongodb utility object.
@brief This function sets up the mongodb utility object .
/**
     * @brief This function inserts the given record using the mongoose
     *        document "save" function.
     *
     * @param record document to be saved
     * @param callback function invoked once "save" operation completes:
     *                 function cb(error)
     *
     * @return none
     */ /**
     * @brief This function looksup a record using the mongoose "findOne"
     *        query function with the given criteria.
     *
     * @param model model to be searched
     * @param criteria criteria for looking up an object
     * @param callback function invoked once "findOne" operation completes:
     *                 function cb(error, document)
     *
     * @return none
     */ /**
     * @brief This function updated the given record using the mongoose
     *        document "save" function.
     *
     * @param record document to be saved
     * @param callback function invoked once "save" operation completes:
     *                 function cb(error)
     *
     * @return none
     */