我在此語法中使用了Mongo集合。如何將每個文件導出到包含數組的文本文件中?使用javascript將mongo集合中的所有數據轉換爲文本文件
{
_id: 1,
"author": [
{
"fname": "Petr",
"lname": "Kocircurka"
}
],
"title": "On topological dynamics of Turing machines",
"journal": "Theor. Comput. Sci.",
"volume": "174",
"pages": [
{
"FirstNumber": "203",
"LastNumber": "216"
}
],
"year": "1997",
"url": "http://www.sciencedirect.com/science/journal/03043975/"
}{
_id: 2,
"author": [
{
"fname": "Aviezri",
"lname": "Fraenkel"
},
{
"fname": "Jamie",
"lname": "Simpson"
}
],
"title": "The exact number of squares in Fibonacci words",
"journal": "Theor. Comput. Sci.",
"volume": "218",
"pages": [
{
"FirstNumber": "95",
"LastNumber": "106"
}
],
"year": "1999",
"url": "http://www.sciencedirect.com/science/journal/03043975/"
}
感謝
您是否嘗試過'mongoexport'效用? https://docs.mongodb.org/manual/reference/program/mongoexport/我知道它適用於CSV和JSON。不確定它是否解決了您的特定需求。 – Sergio
是的,我有它不導出數組,也嘗試把./mongoexport – Abiwax
你可以發佈你用於導出集合及其輸出的命令? – codenut