0
我正在爲我的spring應用程序使用cloudantDB作爲數據庫。從cloudant json獲取匹配部分
,我試圖做的事情是:
檢查是否有文檔中的時隙和話題
如果填寫一個話題:
檢查已提交該主題的userId並返回該用戶的所有項目。
{
"_id": "393c7748cf487f7c5223839dfdf5adf9",
"_rev": "2-889c6d9d14fcc3c90a00e91aca5f2f4c",
"name": "conference 1",
"type": "conference",
"location": "conf loc",
"tag": "confTag",
"startDate": "2015-05-04T22:00:00.000+0000",
"endDate": "2015-05-08T22:00:00.000+0000",
"timeslots": {
"8a03b160-48e3-4f99-be38-2a2da34e5890": {
"id": "8a03b160-48e3-4f99-be38-2a2da34e5890",
"startDate": "2015-04-07T10:45:00.000+0000",
"endDate": "2015-05-07T12:45:00.000+0000",
"location": "Location",
"topic": {
"id": "4ad235ef-5938-4461-8a2e-346bf105c5b6",
"title": "wa nen coole title",
"description": "dees is een goei omschrijving",
"tags": "cloud, tag",
"attachment": "file.exe",
"speakerId": null
}
},
"a59b1dfd-d1c5-491f-bc02-807e38595ba4": {
"id": "a59b1dfd-d1c5-491f-bc02-807e38595ba4",
"startDate": "2015-05-05T10:00:00.000+0000",
"endDate": "2015-05-05T11:15:00.000+0000",
"location": "mlkjs",
"topic": {
"id": "8b753adb-9a15-486f-9209-b9cc5ef134a1",
"title": "test132",
"description": "met speakerId",
"tags": "sldkjf",
"attachment": "kklsjdf",
"speakerId": "speaker"
}
},
"080153e7-f8bc-453e-b49a-a1df4679ceef": {
"id": "080153e7-f8bc-453e-b49a-a1df4679ceef",
"startDate": "2015-05-09T11:30:00.000+0000",
"endDate": "2015-05-09T13:30:00.000+0000",
"location": "file upload",
"topic": {
"id": "e3533a60-a0ba-4439-a9e9-b29e69be47db",
"title": "fdgdfg",
"description": "fdsgdsggdfgdfg",
"tags": "dfgsdg",
"attachment": null,
"speakerId": null
}
}
},
"defaultTwitterText": "Hallo",
"twitterUrl": "https://twitter.com/intent/tweet?button_hashtag=confTag&text=Hallo"
}
到目前爲止,我有這樣的:
function(doc) {
{ if (doc.type === 'conference') {
if(doc.timeslots.size !==0){
emit(null, doc);
}
}
}
}
謝謝!