MongoDB |将几行导入数组

时间:2019-06-25 20:18:21

标签: mongodb csv mongoimport

我有一个csv文件,如下所示:

num, wos_id, uid
0,WOS:000203003600001,000357964900087.13
1,WOS:000203003600001,WOS:000202966700005
2,WOS:000203003600001,WOS:000203003600001.7
3,WOS:000203003600001,WOS:A1953UB69200061
4,WOS:000203003600001,WOS:A1955WK63900001
5,WOS:000203003600001,WOS:A1956WA67600017

我已经导入了一些看起来像这样的文档:

{
        "_id" : ObjectId("5d12772203c3431ec09eed56"),
        "" : 0,
        "wos_id" : "WOS:A1971K031600006",
        "accession_no" : "K0316",
        "issn" : "0043-1303",
        "title" : "TOXIC EFFECTS OF AMMONIA NITROGEN IN HIGH-RATE DIGESTION",
        "pubtype" : "Journal",
        "doctype" : "Article",
        "pubyear" : 1971,
        "pubmonth" : 1,
        "pubday" : 1,
        "language" : "English",
        "source" : "JOURNAL WATER POLLUTION CONTROL FEDERATION",
        "page_range" : "1658-&",
        "page_count" : 0,
        "has_abstract" : 0
}

现在,我希望能够使用wos_id作为键将uid导入到单个文档中,并将其附加到上述文档中。 (值不相同,但要点是。)


{
_id: Object(*)
wos_id: "WOS:000203003600001"

... info from above

uid: [
/array of uids
]

}

我该怎么做?为引用(uid)数组创建文档,然后将其嵌套到原始文档中会更有意义吗?查询的目的是跟踪并向下移动这些引用。

0 个答案:

没有答案