I need to update a document by inserting a bid into the Bid array which is part of Bid. An example document is below:
{
"_id" : "1044300051",
"Bids" : {
"Bid" : [
{
"Bidder" : {
"_id" : "pickford25",
"_Rating" : 255,
"Location" : "ANIME PARADISE",
"Country" : "USA"
},
"Time" : "Dec-07-01 15:02:54",
"Amount" : 1.12
},
{
"Bidder" : {
"_id" : "arlnwtkwsk@aol.com",
"_Rating" : 61,
"Location" : "ARCADE, NEW YORK",
"Country" : "USA"
},
"Time" : "Dec-09-01 15:02:54",
"Amount" : 1.25
}
]
}
}
Here are some of the queries I have attempted:
db.items.update({_id: "1678348584"}, {$set: {Bids: "Bid[]"}},{$push: {"Bids.Bid": {"Amount":1000}}});
db.items.update({_id: "1678348584"}, {$push: {"Bids": [{"Amount":1000}]}});
The specific _id I am trying to update in the above examples has "Bids" set to null initially