【发布时间】:2015-11-24 07:14:44
【问题描述】:
"termsrelation" : [
{
"rel": "RT",
"terms": [
{
"objid": "55dc25083d2cbcb8b0dc48c8",
"source": null,
"scopeNote": [
{
"sourceType": "source",
"source": "abc"
}
],
"formated_name": "Milkbuns",
"name": "Milkbuns",
"type": null,
"url": "test.com",
"nodeid": "14050"
},
{
"objid": "552cae1940feb9123e3f5fb6",
"source": null,
"scopeNote": [
{
"sourceType": "source",
"source": "xyz"
}
],
"formated_name": "Milkchocolate",
"name": "Milkchocolate",
"type": null,
"url": "test.com",
"nodeid": "193570"
}
]
}
]
我要推
{
"sourceType" : "source",
"source" : "def"
}
json to scopeNote object where name = Milkchocolate by java,请帮帮我
我用搜索查询{ "$and" : [ { "id" : "4003"} , { "termsrelation.rel" : "RT"} , { "termsrelation.terms.scopeNote.sourceType" : "source"} , { "termsrelation.terms.scopeNote.source" : "xyz"} , { "termsrelation.terms.name" : "Milk chocolate"}]} 尝试了这个查询{ "$push" : { "termsrelation.$.terms.$.scopeNote" : { "sourceType" : "source" , "source" : "ddd" }}},但没有用
【问题讨论】:
-
你试过什么?请显示代码尝试提供一些上下文。
"termsrelation"是集合名称还是文档中的元素,目前还不清楚。 -
文档中的元素
-
我试过这个查询 { "$push" : { "termsrelation.$.terms.$.scopeNote" : { "sourceType" : "source" , "source" : "ddd" }}}使用搜索查询 { "$and" : [ { "id" : "4003"} , { "termsrelation.rel" : "RT"} , { "termsrelation.terms.scopeNote.sourceType" : "source"} , { " termsrelation.terms.scopeNote.source" : "xyz"} , { "termsrelation.terms.name" : "牛奶巧克力"}]} 但没用
-
请edit您的问题,而不是在 cmets 中发帖
标签: java json mongodb mongodb-query