Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-4439

In 2.8 mongoimport and mongoexport support nested/embedded documents

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • v1.3.15, mongodb-3.0
    • Affects Version/s: None
    • Component/s: manual
    • Labels:
      None

      For example:

      mongo test --quiet --eval "db.test.drop(); db.test.insert({name:'richard', tel: {type: 'mobile', value:101010}}); printjson(db.test.findOne())" && \
      mongoexport --csv --db test -c test -f 'name,tel.type,tel.value' -o file.csv && \
      mongoimport --type csv -d test -c test --file file.csv --headerline --drop && \
      mongo test --quiet --eval "printjson(db.test.findOne())"
      
      {
      	"_id" : ObjectId("54783ea521993726baf8bdb1"),
      	"name" : "richard",
      	"tel" : {
      		"type" : "mobile",
      		"value" : 101010
      	}
      }
      2014-11-28T09:21:41.407+0000	connected to: localhost
      2014-11-28T09:21:41.407+0000	exported 1 record
      2014-11-28T09:21:41.416+0000	connected to: localhost
      2014-11-28T09:21:41.417+0000	dropping: test.test
      2014-11-28T09:21:41.418+0000	imported 1 document
      {
      	"_id" : ObjectId("54783ea5a67a06329c2e539f"),
      	"name" : "richard",
      	"tel" : {
      		"type" : "mobile",
      		"value" : 101010
      	}
      }
      

            Assignee:
            sam.kleinman Sam Kleinman (Inactive)
            Reporter:
            gianfranco Gianfranco Palumbo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              9 years, 21 weeks, 6 days ago