0

Is there a way to get the distinct keys of infos objects ? in other words, the list ['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"
    },
}
Ghilas BELHADJ
  • 13,412
  • 10
  • 59
  • 99

0 Answers0