如有这个文档,是一个多级的树结构 :
var josndata ={
text:'xxxxx',
id: Objectid2,
children[
{text:'xxxxxx',id:Objectid2, children[ text:'xxxxx',id:Objectid3,children[... ]] },
{text:'xxxxxx',id:Objectid4, children[ text:'xxxxx',id:Objectid5,children[ ...]] }
}
}
我已知 Objectid3 , 想找到这个节点,并修改 text 的值,请问find() 怎么写。 我查过有数组对象的关键字:$elemMatch 好像只支持一层的对象。我的是对象内又有数组,数组内可能又有对象是一个多级结构。