Skip to content

User model and key in MongoDb & Redis

bstsnail edited this page Nov 18, 2016 · 4 revisions

Users

{
    id:string,
    email:string,
    password:string,
    keys: [
        {
            "name": string,
            "type": string,
            "key": string
        }
    ]
}

Users In Redis

In Redis, we only store id and the keys the keys is store Set in redis, the Set name is like xbit_id.

For example the user:

{
    "id": "abcd",
    "email": "example@logicmonitor.com",
    "password": "xxx",
    "keys": [
        {
            "name": "device1",
            "type": "mobile",
            "key": "k1"
        },
        {
            "name": "device2",
            "type": "mobile",
            "key": "k2"
        }
    ]
}

So the data in Redis is

"mobile" -> Set("k1", "k2")

Clone this wiki locally