In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Suppose all the documents in our collection are in this format:
{"_ id": ObjectId ("5c177b84f4e84940e0bd578d"), "name": "suhaozhi", "pwd": "suhaozhi", "phone": [{"phone_num": "13333333333", "type": "cmcc"}, {"phone_num": 1555555555, "type": "chinanet"}], "type": "chinanet"}
Now you need to search for records whose type subfield in the phone field has a value of CMCC:
Db.tmp.find ({phone: {$elemMatch: {cs: "cmcc"})
If you want to modify the type field corresponding to the phone_num of 13333333333 in the phone field of the above document, it is chinanet:
Db.tmp.update ({"name": "suhaozhi", "phone.phone_num": "13333333333"}, {$set: {"phone.$.cs": "chinanet"}})
If you want to embed the document, insert another piece of data:
Db.tmp.update ({"name": "suhaozhi"}, {$push: {"phone_num": "23333", "type": "cmcc"})
Delete a piece of data from the embedded document:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.