Node.JS 要点

登录前

/* 0 */
{
    "_id" : "7V5iCMBUTq2u2akSoaQHSy1Y",
    "session" : "{\"cookie\":{\"originalMaxAge\":1800000,\"expires\":\"2014-11-10T22:23:03.371Z\",\"httpOnly\":true,\"path\":\"/\"},\"passport\":{}}",
    "expires" : ISODate("2014-11-10T22:23:03.371Z")
}

登录后

/* 0 */
{
    "_id" : "7V5iCMBUTq2u2akSoaQHSy1Y",
    "session" : "{\"cookie\":{\"originalMaxAge\":1799999,\"expires\":\"2014-11-10T22:24:35.059Z\",\"httpOnly\":true,\"path\":\"/\"},\"passport\":{\"user\":\"542ae1fe87815a0f09621532\"}}",
    "expires" : ISODate("2014-11-10T22:24:35.059Z")
}

node session

    // Express/Mongo session storage
    app.use(express.session({
        secret: config.sessionSecret,
        cookie: {
            maxAge: 1000 * 60 * 30 //0.5 hours
            //maxAge: 1000 * 10   //10 seconds
        },
        store: new mongoStore({
            db: db.connection.db,
            collection: config.sessionCollection
        }),
        rolling: true
    }));

App schema

/**
 * Application Schema
 */
var ApplicationSchema = new Schema({
    name: String,
    guid: String,
    git_url: String,
    group_name: String,
    space_guid: String,
    app_type: String,
    //添加模板应用相关的模板信息,c00277927
    template_id: String,//模板ID
    template_file_path: String,//模板文件名称
    blob_url: String
});

User Schema

/**
 * User Schema
 */
var UserSchema = new Schema({
    name: String,
    email: String,
    username: {
        type: String,
        unique: true
    },
    guid: String,
    authorization_endpoint: String,
    token: String,
    refresh_token: String,
    current_space_guid: String,
    current_space_name: String,
    current_org_guid: String,
    current_org_name: String,
    current_org_idx: Number,
    current_space_idx: Number,
    orgs_summary: [],
    is_manager: Boolean,
    //是否是服务发布商
    is_service_provider:Boolean,
    hashed_password: String,
    provider: String,
    salt: String,
    actived: Boolean,
    activate_key: String,
    reset_pwd_guid: String,
    userScore: Number,
    scoreHistory:[MonthlyDetails]
});

Org Schema

/**
 * Organization Schema
 */
var OrganizationSchema = new Schema({
    name: String,
    guid: String,
    managers: {},
    billing_managers: [],
    auditors: []
});

你可能感兴趣的:(Node.JS 要点)