Using mongoimport to read CSV into nested structure?

前端 未结 1 1139
轻奢々
轻奢々 2021-01-12 22:12

I have a mongo document with a structure like: { \"foo\": { \"bar1\": \"val1\", \"bar2\": \"val2\"} } I\'d like to import my data from a csv using mongoim

相关标签:
1条回答
  • 2021-01-12 22:48

    This isn't supported in the current (v2.0) version of mongoimport, but it should be coming soon. You can check out the JIRA ticket here, scheduled for v2.1:

    • Dotted field names should produce nested objects in mongoimport

    Until then, if you can translate your CSV data to JSON then you could use mongoimport --type json to import the nested data.

    EDIT: This feature is released now, and available from 2.8.0-rc0

    0 讨论(0)
提交回复
热议问题