文档如下:

{
        "_id" : ObjectId("578f2122774326567ca82dfe"),
        "person" : {
                "age" : 28,
                "name" : "liqing",
                "_type" : "person"
        }
}

现在需要查询person中age为28的

查询:

 db.test.find({"person.age":28})

或者:

db.test.find({"person":{"age":28,"name:"liqing","_type":"person"}})

现在需要把age修改为27

修改:

db.test.update({"person.age":28},{$set:{"person.age":27}})



相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-14
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
猜你喜欢
  • 2021-11-09
  • 2021-12-17
  • 2022-12-23
  • 2021-10-10
  • 2021-11-08
  • 2022-12-23
相关资源
相似解决方案