在没有父母的情况下获取所有子文档

时间:2019-03-31 00:25:29

标签: node.js mongodb mongoose schema

假设我具有以下JSON

{
    "name":"xpto",
    "assets":[{
        "name":"ypto",
        "orders":[{
            "client":"John",
        }],
        "dues": [{
            "refMonth":"01/2019",
        },{
            "refMonth":"02/2019",
        }]
    },
    {
        "name":"tpto",
        "orders":[{
            "client":"John",
        }],
        "dues": [{
            "refMonth":"01/2019",
        },{
            "baseDate":"02/2019",
        }]
    }]
}

我需要获取所有“ refMonth”字段,与父级无关。

我正在使用猫鼬,并且已经尝试过 MarketModel.findOne({"Name": req.params.market, "Assets.Name": req.params.asset}, callback),但它带给我整个json

0 个答案:

没有答案
相关问题