PyMongo Update document with multiple records

前端 未结 2 586
自闭症患者
自闭症患者 2021-01-26 14:34

I have a dictionary that looks like this:

{
    \"username\": \"SHAURYA\",
    \"stocks\": [{
        \"name\": \"WXYZ\",
        \"count\": 2,
        \"price\"         


        
2条回答
  •  一整个雨季
    2021-01-26 14:51

    MongoDB is case-sensitive. Use "stocks" instead of "Stocks" in your push operation, and the subdocument will be correctly append to the array.

提交回复
热议问题