1
我一直在試圖將某些元素放入此代碼中。 (請忽略愚蠢的虛擬數據)無法在Mongodb中將對象插入到對象數組中
{
"Order_Number": "1",
"Status": "Pending",
"Customer":{
"First_Name": "Juan",
"Second_Name": "De La Cruz",
"Email": "[email protected]",
"contact": "0923275937"
},
"Shipping_Address": "291,Ominous Building, Quezon City, Philippines",
"Billing_Address": "IOU, Iowa, USA",
"Weight": "200 lbs.",
"Description": "Joots",
"Tracking Information": {
"Tracking Number": "000000001",
"Shipping History": {
"Shipping Transactions": [
{
"Date Received": "10/1/2013",
"Date Released": "10/10/2013",
"Source": "Center of the earth",
"Control Number": "100010001"
},
{
"Date Received": "10/2/2013",
"Date Released": "10/12/2013",
"Source": "Center of Venus",
"Control Number": "100010002"
},
{
"Date Received": "10/3/2013",
"Date Released": "10/13/2013",
"Source": "San Francisco",
"Control Number": "100010003"
}
]
}
}
}
現在,我一直在試圖將這些元素轉換爲「Shipping Transactions」。
{
"Date Received": "10/2/2013",
"Date Released": "10/11/2013",
"Source": "Center of Mars",
"Control Number": "100010005"
}
我試過做推動,但它甚至沒有將自己添加到數組中。
{$push:{"Tracking Information":{"Shipping History":{"Shipping Transactions":
[{"Date Received": "10/4/2013",
"Date Released": "10/11/2013",
"Source": "Center of Mars",
"Control Number": "100010005"}]
}
可能這段代碼有缺陷或我做錯了什麼?我只使用MongoDb的web shell btw。