MongoDB update array appears can ' t append to array using string field name

Source: Internet
Author: User

The database content is probably as follows:

{_id:1,"hero_list" : {                "15521" : {                        "stars":0,                        "_id":15521,                        "Equip" : [                                [ ],                                [ ],                                [ ], {                                        "item_id":310141,                                        "LV":103,                                        "UUID":"4a727ee1-e7b0-4265-b004-e2b75890378a",                                        "Amount":1                                },                                [ ],                                [ ] ],                        "LV": the,                        "Exp":0,                        "Quality":0                }            }}

> db.hero.update ({_id:1},{$set: {"hero_list.15521.equip.4.lv": 1}})
Can ' t append to array using string field name [LV]

For a long while, the original is their own eyesight, the array of subscript number is wrong

Db.hero.update ({_id:1},{$set: {"hero_list.15521.equip.3.lv": 1}})

Ok

MongoDB update array appears can ' t append to array using string field name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.