Mongodb-如何展开对象而不是数组

时间:2016-07-28 07:53:07

标签: mongodb

我有这样的系列,我需要放松" myuser"对象

{"_id" : ObjectId("578508630420bec15ea9876c"),
   "current" : "selectCategory",
   "myuser" : {
    "_id" : "56c49c540d9e391243ce2752",
    "myoptions" : [ 
    {
        "id" : "jobs",
        "name" : "Emploi"
    }
    ],
    "mychannel" : "ussd",
    "mycreateDate" : "2016-02-17T16:14:12.899Z",
    "myemail" : "",
    "mygender" : "",
    "myhidemsisdn" : "no",
    "mylang" : "fr",
    "mylastUpdate" : "2016-02-26T11:32:29.786Z",
    "myyob" : -1
     },
    "userInput" : "continue",
    "ussdsession" : "303819320" }

我正在寻找像myuser这样的输出:

["_id","myoptions","mychannel","mycreatedate","myemail","mygender","myhidemsisdn","mylang","mylastupdate","myyob"]

我可以获取集合的键。但是myuser是一个嵌套的对象,它有键。提前谢谢

0 个答案:

没有答案