对象数组内部的深度填充对象数组

时间:2019-05-07 07:47:37

标签: node.js mongodb express mongoose

我该如何填充产品和对象数组。我试着使用路径填充,填充其不起作用。

但是通常我可以填充其他简单嵌套的数据。

StaticInjectorError(root)[ChildrenOutletContexts]: NullInjectorError: No provider for ChildrenOutletContexts!

我以前填充的路线是:

 {
    "_id": "5cd0dfcd9ce8240dd4c70e87",
    "refno1": "Ref1",
    "refno2": "WWWWW1111",
    "date": "2019-05-13T00:00:00.000Z",
    "customer": "5c98b9c9a435482fccc3c20a",
    "customertype": "5c7524f76792cf28f80793e3",
    "department": "5cbd67c709aeca1ea480157a",
    "products": [
    {
    "warrantyfrom": "2019-05-06T00:00:00.000Z",
    "warrantyto": "2019-05-14T00:00:00.000Z",
    "oemwarrantyfrom": "2019-05-21T00:00:00.000Z",
    "oemwarrantyto": "2019-05-06T00:00:00.000Z",
    "_id": "5cd0dfef9ce8240dd4c70e88",
    "oem": "5cb6dc624708df233c4afd31",
    "category": "5ca35cf59ccd6a20d82419f4",
    "subcategory": "5cb818725588431cd0ec3ceb",
    "modelno": "M1234",
    "serialno": "sasasa"
    },
    {
    "warrantyfrom": "2019-05-14T00:00:00.000Z",
    "warrantyto": "2019-05-30T00:00:00.000Z",
    "oemwarrantyfrom": "2019-05-29T00:00:00.000Z",
    "oemwarrantyto": "2019-05-22T00:00:00.000Z",
    "_id": "5cd0e1559ce8240dd4c70e94",
    "oem": "5c986a1e9b6bc614b8a551b9",
    "category": "5c960902e5cf3429e06beb6c",
    "subcategory": "5ca35fbed6e1430df88954a6",
    "modelno": "QW123",
    "serialno": "fdsfdsfs"
    }
    ],
    "__v": 2
    }

0 个答案:

没有答案