0
這是一個包含2個json文件的單個集合。我正在尋找一個特定的字段:對象中的值,如果匹配,必須返回整個子文檔(集合中的該特定子文檔必須從以下集合中的2個子文檔中返回)。提前致謝。當(字段,值)匹配時,MongoDB find()返回子文檔
{
"clinical_study": {
"@rank": "379",
"#comment": [],
"required_header": {
"download_date": "ClinicalTrials.gov processed this data on March 18, 2015",
"link_text": "Link to the current ClinicalTrials.gov record.",
"url": "http://clinicaltrials.gov/show/NCT00000738"
},
"id_info": {
"org_study_id": "ACTG 162",
"secondary_id": "11137",
"nct_id": "NCT00000738"
},
"brief_title": "Randomized, Double-Blind, Placebo-Controlled Trial of Nimodipine for the Neurological Manifestations of HIV-1",
"official_title": "Randomized, Double-Blind, Placebo-Controlled Trial of Nimodipine for the Neurological Manifestations of HIV-1",
}
{
"clinical_study": {
"@rank": "381",
"#comment": [],
"required_header": {
"download_date": "ClinicalTrials.gov processed this data on March 18, 2015",
"link_text": "Link to the current ClinicalTrials.gov record.",
"url": "http://clinicaltrials.gov/show/NCT00001292"
},
"id_info": {
"org_study_id": "920106",
"secondary_id": "92-C-0106",
"nct_id": "NCT00001292"
},
"brief_title": "Study of Scaling Disorders and Other Inherited Skin Diseases",
"official_title": "Clinical and Genetic Studies of the Scaling Disorders and Other Selected Genodermatoses",
}
你有哪些特定字段/值和子文檔的例子嗎? – chridam 2015-04-05 06:59:35
我已經使用此模式進行搜索(「clinical_study。@ rank」,「379」);並且它匹配但無法取回它所在的子文檔。 – Vamshi 2015-04-05 07:52:27
當你在mongo shell中執行這個查詢時得到了什麼結果db.TargetCollection.find({「clinical_study。@ rank」:「379」}) – kevin 2015-04-05 11:31:58