获取对象

时间:2016-06-30 10:07:05

标签: mongodb

有没有办法获取infos个对象的不同键?换句话说,列表['lastname', 'firstname', 'birthday', 'city']

/* QUERY */
db.users.find({})

/* 1 */
{
    "_id" : "ee4068dbbe0005ed23249f38ce691665",
    "infos" : {
        "lastname" : "MATOUB",
        "firstname" : "Lounes"
    },
}

/* 2 */
{
    "_id" : "0005ed232ee4068dbbe49f38ce6968db",
    "infos" : {
        "birthday": "19560312",
        "lastname" : "DOMRANE",
        "firstname" : "Malika"
    },
}

/* 3 */
{
    "_id" : "68dbbe49f38e4068dbbe49f38ce69384",
    "infos" : {
        "lastname" : "AZEM",
        "firstname" : "Slimane",
        "city": "Tizi Ouzou"
    },
}

0 个答案:

没有答案