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。