无法查询从 CSV 转换而来的 JSON 数据
Not able to query the JSON data converted from CSV
我正在尝试 运行 以下 JSON 基本上来自 CSV 文件的数据。我只能在
db.learning.find({})
而当我尝试访问特定文档时,它没有给出任何输出。
JSON数据在下面
/* 1 */
{
"_id" : ObjectId("624edebb78036379835d29a7"),
"pmid" : 32339032,
"ti" : "SAFETY AND EFFICACY OF DDP4-INHIBITORS FOR MANAGEMENT OF HOSPITALIZED GENERAL MEDICINE AND SURGERY PATIENTS WITH TYPE 2 DIABETES.",
"year" : "2020",
"population" : "['general medicine and surgery patients with T2D', 'general medicine and surgery patients with type 2 diabetes (T2D', 'n=266) and surgery (n=319) patients admitted with a blood glucose (BG) between 140 and 400 mg/dl, treated with']",
"population_mesh" : "[{'cui': 'C0086343', 'cui_str': 'General medicine'}, {'cui': 'C0038895', 'cui_str': 'operative procedures'}]",
"journal" : "Endocrine practice : official journal of the American College of Endocrinology and the American Association of Clinical Endocrinologists",
"dois" : "['10.4158/EP-2019-0481']"
}
/* 2 */
{
"_id" : ObjectId("624edebb78036379835d29a8"),
"pmid" : 32339033,
"ti" : "SAFETY AND EFFICACY OF DDP4-INHIBITORS FOR MANAGEMENT OF HOSPITALIZED GENERAL MEDICINE AND SURGERY PATIENTS WITH TYPE 2 DIABETES.",
"year" : "2021",
"population" : "['general medicine and surgery patients with T2D', 'general medicine and surgery patients with type 2 diabetes (T2D', 'n=266) and surgery (n=319) patients admitted with a blood glucose (BG) between 140 and 400 mg/dl, treated with']",
"population_mesh" : "[{'cui': 'C0086343', 'cui_str': 'General medicine'}, {'cui': 'C0038895', 'cui_str': 'operative procedures'}]",
"journal" : "Endocrine practice : official journal of the American College of Endocrinology and the American Association of Clinical Endocrinologists",
"dois" : "['10.4158/EP-2019-0481']"
}
即)
db.collectionName.find(year:"2020")
和其他类似的查询没有给出任何输出所以 JSON 数据或我的 mongo shell 命令有什么问题吗?
当我通过删除“”将 JSON 表单字符串数据的两个字段更改为字段数组时,我能够 运行 查询
reformed JSON 在这里给出了输出。
我不知道它是怎么发生的。但是我得到了结果
{
"_id": {
"$oid": "624edebb78036379835d29a7"
},
"pmid": 32339032,
"ti": "SAFETY AND EFFICACY OF DDP4-INHIBITORS FOR MANAGEMENT OF HOSPITALIZED GENERAL MEDICINE AND SURGERY PATIENTS WITH TYPE 2 DIABETES.",
"year": "2020",
"population": [
"general medicine and surgery patients with T2D",
"general medicine and surgery patients with type 2 diabetes (T2D",
"n=266) and surgery (n=319) patients admitted with a blood glucose (BG) between 140 and 400 mg/dl, treated with"
],
"population_mesh": [
{
"cui": "C0086343",
"cui_str": "General medicine"
},
{
"cui": "C0038895",
"cui_str": "operative procedures"
}
],
"journal": "Endocrine practice : official journal of the American College of Endocrinology and the American Association of Clinical Endocrinologists",
"dois": "['10.4158/EP-2019-0481']"
}
我正在尝试 运行 以下 JSON 基本上来自 CSV 文件的数据。我只能在
db.learning.find({})
而当我尝试访问特定文档时,它没有给出任何输出。
JSON数据在下面
/* 1 */
{
"_id" : ObjectId("624edebb78036379835d29a7"),
"pmid" : 32339032,
"ti" : "SAFETY AND EFFICACY OF DDP4-INHIBITORS FOR MANAGEMENT OF HOSPITALIZED GENERAL MEDICINE AND SURGERY PATIENTS WITH TYPE 2 DIABETES.",
"year" : "2020",
"population" : "['general medicine and surgery patients with T2D', 'general medicine and surgery patients with type 2 diabetes (T2D', 'n=266) and surgery (n=319) patients admitted with a blood glucose (BG) between 140 and 400 mg/dl, treated with']",
"population_mesh" : "[{'cui': 'C0086343', 'cui_str': 'General medicine'}, {'cui': 'C0038895', 'cui_str': 'operative procedures'}]",
"journal" : "Endocrine practice : official journal of the American College of Endocrinology and the American Association of Clinical Endocrinologists",
"dois" : "['10.4158/EP-2019-0481']"
}
/* 2 */
{
"_id" : ObjectId("624edebb78036379835d29a8"),
"pmid" : 32339033,
"ti" : "SAFETY AND EFFICACY OF DDP4-INHIBITORS FOR MANAGEMENT OF HOSPITALIZED GENERAL MEDICINE AND SURGERY PATIENTS WITH TYPE 2 DIABETES.",
"year" : "2021",
"population" : "['general medicine and surgery patients with T2D', 'general medicine and surgery patients with type 2 diabetes (T2D', 'n=266) and surgery (n=319) patients admitted with a blood glucose (BG) between 140 and 400 mg/dl, treated with']",
"population_mesh" : "[{'cui': 'C0086343', 'cui_str': 'General medicine'}, {'cui': 'C0038895', 'cui_str': 'operative procedures'}]",
"journal" : "Endocrine practice : official journal of the American College of Endocrinology and the American Association of Clinical Endocrinologists",
"dois" : "['10.4158/EP-2019-0481']"
}
即)
db.collectionName.find(year:"2020")
和其他类似的查询没有给出任何输出所以 JSON 数据或我的 mongo shell 命令有什么问题吗?
当我通过删除“”将 JSON 表单字符串数据的两个字段更改为字段数组时,我能够 运行 查询
reformed JSON 在这里给出了输出。 我不知道它是怎么发生的。但是我得到了结果
{
"_id": {
"$oid": "624edebb78036379835d29a7"
},
"pmid": 32339032,
"ti": "SAFETY AND EFFICACY OF DDP4-INHIBITORS FOR MANAGEMENT OF HOSPITALIZED GENERAL MEDICINE AND SURGERY PATIENTS WITH TYPE 2 DIABETES.",
"year": "2020",
"population": [
"general medicine and surgery patients with T2D",
"general medicine and surgery patients with type 2 diabetes (T2D",
"n=266) and surgery (n=319) patients admitted with a blood glucose (BG) between 140 and 400 mg/dl, treated with"
],
"population_mesh": [
{
"cui": "C0086343",
"cui_str": "General medicine"
},
{
"cui": "C0038895",
"cui_str": "operative procedures"
}
],
"journal": "Endocrine practice : official journal of the American College of Endocrinology and the American Association of Clinical Endocrinologists",
"dois": "['10.4158/EP-2019-0481']"
}