Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-1239

Mongoexport won't exclude _id from export

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      Can't seem to eliminate _id from mongoexport with --fields.

      Steps to reproduce:

      $ mongoexport --version
      mongoexport version: r3.2.7
      git version: 2214d4d6561574f962c1dc72fefce4fe11843023
      cat foo.json
      {"_id":{"$oid":"57605d5dc3d5a2429db0bce8"},"signup":{"$date":"2010-07-31T14:17:27.000Z"},"points":990061,"name":"Nick"}
      {"_id":{"$oid":"57605d5dc3d5a2429db0bce9"},"signup":{"$date":"2010-06-02T00:21:35.000Z"},"points":291770,"name":"Ophelia"}
      {"_id":{"$oid":"57605d5dc3d5a2429db0bcea"},"signup":{"$date":"2008-03-28T07:43:53.000Z"},"points":232650,"name":"Nick"}
      $ mongoimport --drop -d test -c people foo.json
      2016-06-14T16:30:26.683-0400	connected to: localhost
      2016-06-14T16:30:26.684-0400	dropping: test.people
      2016-06-14T16:30:26.849-0400	imported 3 documents
      $ mongoexport -d test -c people --fields "name,points"
      2016-06-14T16:30:38.564-0400	connected to: localhost
      {"_id":{"$oid":"57605d5dc3d5a2429db0bcea"},"points":232650,"name":"Nick"}
      {"_id":{"$oid":"57605d5dc3d5a2429db0bce8"},"points":990061,"name":"Nick"}
      {"_id":{"$oid":"57605d5dc3d5a2429db0bce9"},"points":291770,"name":"Ophelia"}

      Expected result would be for the _id to be eliminated. Not seeing a way around this.

            Assignee:
            Unassigned Unassigned
            Reporter:
            william.cross William Cross
            Votes:
            3 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: