lib/index.js
function MongoStore(options) {
        options = options || {};

        for (var property in defaultOptions) {
            if (defaultOptions.hasOwnProperty(property)) {
                if (!options.hasOwnProperty(property) || (typeof defaultOptions[property] !== typeof options[property]))
                    options[property] = defaultOptions[property];
            }
        }

        Store.call(this, options.store);

        var dbProperties = ["name", "prefix", "servers", "credentials", "URLParam", "extraParam"];
        var dbPropertiesLen = dbProperties.length;
        var dbOptions = {};
        for (var i = 0; i < dbPropertiesLen; i++)
            dbOptions[dbProperties[i]] = options[dbProperties[i]];

        this.mongo = new Mongo(dbOptions);
        this.mongo.ensureIndex(options.collection, {expires: 1}, {expireAfterSeconds: 0}, function (err, result) {
            if (err)
                throw new Error('Error setting TTL index on collection : ' + options.collection + ' <' + err + '>');
        });

        this._options = {
            "collection": options.collection,
            "stringify": options.stringify,
            "expireAfter": options.expireAfter
        };
    }
function MongoStore(options) {
        options = options || {};

        for (var property in defaultOptions) {
            if (defaultOptions.hasOwnProperty(property)) {
                if (!options.hasOwnProperty(property) || (typeof defaultOptions[property] !== typeof options[property]))
                    options[property] = defaultOptions[property];
            }
        }

        Store.call(this, options.store);

        var dbProperties = ["name", "prefix", "servers", "credentials", "URLParam", "extraParam"];
        var dbPropertiesLen = dbProperties.length;
        var dbOptions = {};
        for (var i = 0; i < dbPropertiesLen; i++)
            dbOptions[dbProperties[i]] = options[dbProperties[i]];

        this.mongo = new Mongo(dbOptions);
        this.mongo.ensureIndex(options.collection, {expires: 1}, {expireAfterSeconds: 0}, function (err, result) {
            if (err)
                throw new Error('Error setting TTL index on collection : ' + options.collection + ' <' + err + '>');
        });

        this._options = {
            "collection": options.collection,
            "stringify": options.stringify,
            "expireAfter": options.expireAfter
        };
    }
function MongoStore ( options ) { options = options || { } ; for ( var property in defaultOptions ) { if ( defaultOptions . hasOwnProperty ( property ) ) { if ( ! options . hasOwnProperty ( property ) || ( typeof defaultOptions [ property ] !== typeof options [ property ] ) ) options [ property ] = defaultOptions [ property ] ; } } Store . call ( this , options . store ) ; var dbProperties = [ "name" , "prefix" , "servers" , "credentials" , "URLParam" , "extraParam" ] ; var dbPropertiesLen = dbProperties . length ; var dbOptions = { } ; for ( var i = 0 ; i < dbPropertiesLen ; i ++ ) dbOptions [ dbProperties [ i ] ] = options [ dbProperties [ i ] ] ; this . mongo = new Mongo ( dbOptions ) ; this . mongo . ensureIndex ( options . collection , { expires : 1 } , { expireAfterSeconds : 0 } , function ( err , result ) { if ( err ) throw new Error ( 'Error setting TTL index on collection : ' + options . collection + ' <' + err + '>' ) ; } ) ; this . _options = { "collection" : options . collection , "stringify" : options . stringify , "expireAfter" : options . expireAfter } ; }
Initialize MongoStore with the given `options`.

@param {Object} options
Initialize MongoStore with the given options .