测试数据:{"_id":ObjectId("4b97e62bf1d8c7152c9ccb74"),"title":"ABC","comments":[{"by":"joe","votes":3},{"by":"jane","votes":7}]}执行更新语句:语句一:db.mydb.update({title:"ABC"},{$inc:{"comments.$.votes":1}},0,1)执行报错:Cannotapplythepositionaloperatorwithoutacorrespondingqueryfieldcontaininganarray.语句二:db.mydb.update({"comments.by":"joe"},{$inc:{"comments.$.votes":1}},0,1)执行结果正常请问是怎么回事?
杨__羊羊
HUWWW
慕的地10843
随时随地看视频慕课网APP
相关分类