我有一个架构,其文档结构如下所示:
{ "_id" : ObjectId( "4f8dcb06ee21783d7400003c" ),
"venue" : ObjectId( "4f8dcb06ee21783d7400003b" ),
"name" : "Some event",
"webite: "www.whatever.com",
"attendees" : [
{ "_id" : ObjectId( "4f8dfb06ee21783d7134503a" ), "firstName" : "Joe", "lastName" : "Blogs", "emailAddress" : "some@thing1.com" },
{ "_id" : ObjectId( "4f8dfb06ee21783d7134503b" ), "firstName" : "John", "lastName" : "West", "emailAddress" : "some@thing2.com" }
{ "_id" : ObjectId( "4f8dfb06ee21783d7134503c" ), "firstName" : "Simon", "lastName" : "Green", "emailAddress" : "some@thing3.com" }
{ "_id" : ObjectId( "4f8dfb06ee21783d7134503d" ), "firstName" : "Harry", "lastName" : "Smith", "emailAddress" : "some@thing4.com" }
],
"eventType" : "Party"
}
我有一个 CSV 文件,我想将其导入到与会者集合中...
使用mongoimport 可以吗? 我读到这个:Using mongoimport to read CSV into nested structure? 似乎答案可能是否定的……
由于这是一次性操作,我不介意是否必须将其导入“参加者”集合,然后运行另一个命令插入到我的文档中的参加者集合中?(目前只有一个事件文档....)