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