MongoDb remove subdocument from document

后端 未结 2 1347
挽巷
挽巷 2021-02-07 07:03

I have a collection with a following data:

{

  \"_id\" : ObjectId(\"4e3951905e746b3805000000\"),
  \"m\" : \"hello\",
  \"r\" : [{
      \"_id\" : ObjectId(\"4e         


        
2条回答
  •  时光说笑
    2021-02-07 07:17

    dbh.users.update({"_id": ObjectId("4e39519d5e746bc00f000000")}, {"$unset":{"r":1}},False,False)
    

    Try using unset

    Reference: MongoDB : Update Modifier semantics of "$unset"

提交回复
热议问题