我有一个架构,其文档结构如下所示:
{ "_id" : ObjectId( "4f8dcb06ee21783d7400003c" ),
"venue" : ObjectId( "4f8dcb06ee21783d7400003b" ),
"name" : "Some event",
"webite: "www.whatever.com",
"attendees" : [
{ "_id" : ObjectId( "4f8dfb06ee21783d7134503a" ), "firstName" : "Joe", "lastName" : "Blogs", "emailAddress" : "[email protected] /cdn-cgi/l/email-protection" },
{ "_id" : ObjectId( "4f8dfb06ee21783d7134503b" ), "firstName" : "John", "lastName" : "West", "emailAddress" : "[email protected] /cdn-cgi/l/email-protection" }
{ "_id" : ObjectId( "4f8dfb06ee21783d7134503c" ), "firstName" : "Simon", "lastName" : "Green", "emailAddress" : "[email protected] /cdn-cgi/l/email-protection" }
{ "_id" : ObjectId( "4f8dfb06ee21783d7134503d" ), "firstName" : "Harry", "lastName" : "Smith", "emailAddress" : "[email protected] /cdn-cgi/l/email-protection" }
],
"eventType" : "Party"
}
我有一个 CSV 文件,我想将其导入到与会者集合中...
是否可以使用蒙戈进口? http://www.mongodb.org/display/DOCS/Import+Export+Tools我读到了这个:使用 mongoimport 将 CSV 读入嵌套结构? https://stackoverflow.com/questions/7809986/using-mongoimport-to-read-csv-into-nested-structure答案似乎是否定的……
由于这是一次性操作,因此我不介意是否必须将其导入“与会者”集合,然后运行另一个命令以插入到文档中的与会者集合中? (目前只有一份活动文档......)