不同条目之间值分配的JSON依赖性/条件

时间:2017-03-17 10:01:50

标签: json

我有一个json文件,我想根据BasicDBObject siteObject = new BasicDBObject(); siteObject.append("keywords", "$sites.keywords.keyword"); siteObject.append("lastrank", "$sites.keywords.dailyranks"); BasicDBList aDBList = new BasicDBList(); aaa.add(new BasicDBObject("user", modelLogin.getUSER_NAME())); ArrayList<BasicDBObject> doc = new ArrayList<>(); doc.add(new BasicDBObject().append("$unwind", "$sites")); doc.add(new BasicDBObject("$match", aDBList)); doc.add(new BasicDBObject().append("$project", siteObject)); AggregationOutput output = coll.aggregate(doc); 中选择的内容设置['JKL']['A']的值,即&#34; sample&#34; &#39; value1&#39;,&#39; value2&#39;,&#39; value3&#39;

我认为这可以使用&#39; oneof&#39; JSON模式中的依赖项,但不知道如何继续。这甚至可能吗?

当然,我想从['list']['schema']['properties']['MNO']的至少两个值中选择一个,比如['JKL']['A']&#39; value1&#39; ['MNO']应分配&#34; sample2&#34; ,如果['JKL']['A']&#39; value2&#39; ['MNO']应分配&#34; sample1&#34;

['JKL']['A']

0 个答案:

没有答案